任何人都可以展示defaultProps在TypeScript 中定义React组件类的示例吗?
interface IProps {}
interface IState {}
class SomeComponent extends Component<IProps, IState> {
// ... defaultProps ?
// public defaultProps: IProps = {}; // This statement produces an error
constructor(props: IProps) {
super(props);
}
// ...
}
Run Code Online (Sandbox Code Playgroud)