I am using ESlint
in my react project.
I have to update states and local variables when props
are updated.
ESlint
and React
ask me not to use setState
in:
componentDidMount
componentWillUpdate
componentDidUpdate
getSnapshotBeforeUpdate
I can use only getDerivedStateFromProps
to update state
, but I can't use it to use and update local variables.
And I can use componentWillReceiveProps(nextProps)
to update state and local variables but it doesn't update them in the first loaded.
Is there any good solution to update them?