Closed
Description
According to the defaults static methods come before lifecycle (including constructor) and everything-else. Why does it want me to move gDSFP after the constructor?
30:5 warning getDerivedStateFromProps should be placed after constructor react/sort-comp
This is my component:
export default class FilterFormComponent extends React.Component {
static propTypes = {
setParentField: propTypes.func.isRequired
};
static getDerivedStateFromProps(props, prevState) {
// override internal state from props.
// this allows other widgets and reducers to perform
// corrections which will be reflected next time the
// component is rendered
return {...prevState, ...props};
}
constructor(props) {
super(props);
this.state = {};
}
}
Metadata
Metadata
Assignees
Labels
No labels