Answers for "how to declare defaultprop"

0

how to declare defaultprop

interface IProps {}
interface IState {}

class SomeComponent extends Component<IProps, IState> {
    // ... defaultProps ?
    // public defaultProps: IProps = {}; // This statement produces an error

    constructor(props: IProps) {
        super(props);
    }

    // ...
}
Posted by: Guest on September-15-2021

Browse Popular Code Answers by Language