Closed
Description
When a property is used in getDerivedStateFromProps
but not defined in defaultProps
this doesn't give me a warning or error.
In the below case baz
gives me a react/prop-types
error, I expect this same error from bar
.
class TestClass extends React.PureComponent {
static getDerivedStateFromProps(props) {
const { foo, bar } = props;
return {
foobar: foo(bar),
};
}
render() {
const { baz } = this.props;
const { foobar } = this.state;
return <div>{foobar}</div>;
}
}
TestClass.defaultProps = {
foo: PropTypes.func.isRequired,
};