no-did-update-set-state
Configuration
Disallow this.setState inside componentDidUpdate.
Updating the state after a component update will trigger a second render()
call and can lead to property/layout thrashing.
Rule Details
This rule flags any this.setState call whose enclosing class method, class
field initializer, or object-literal property is keyed componentDidUpdate.
By default, calls inside a nested function (regular or arrow) are allowed —
enable disallow-in-func to forbid them too.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
With disallow-in-func set, the rule also flags this.setState calls inside
nested functions:
React Version
The rule is a no-op when settings.react.version is explicitly set to
>= 16.3.0, matching eslint-plugin-react's shouldBeNoop gate for
componentDidUpdate.