【发布时间】:2018-03-20 06:20:41
【问题描述】:
使用v0.68.0,好像defaultProps不受控制:
以下代码(来自official doc)在声明“foo”defaultProp(作为字符串而不是数字)时不会引发错误:
// @flow
import * as React from "react";
type Props = {
foo: number,
};
class MyComponent extends React.Component<Props> {
static defaultProps = {
foo: 'bad string',
};
}
有什么想法吗? 谢谢
【问题讨论】:
标签: javascript reactjs react-native flowtype