Rules
no-set-state-in-component-will-update
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔍
Presets
core
recommended
recommended-typescript
recommended-type-checked
What it does
Disallows calling this.setState
in componentWillUpdate
outside of functions, such as callbacks.
Updating the state after a component mount will trigger a second render()
call and can lead to property/layout thrashing.
Examples
Failing
Implementation
See Also
no-set-state-in-component-did-mount
Disallows callingthis.setState
incomponentDidMount
outside of functions, such as callbacks.no-set-state-in-component-did-update
Disallows callingthis.setState
incomponentDidUpdate
outside of functions, such as callbacks.