react-doctor/no-impure-state-updater
State updater has side effects
- Category: Bugs
- Severity: error
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: react
- Default: Enabled
Validate the diagnostic
Confirm the reported code matches this rule before you edit it.
Confirm the reported code matches State updater has side effects. Check the framework context and diagnostic message before suppressing it.
How to fix
Follow the rule guidance while preserving unrelated behavior.
Copyable fix prompt
Copy this self-contained prompt into your coding agent after you confirm the diagnostic.
Keep state updater callbacks pure and return only the next state. Move notifications, storage, timers, ref writes, and other external work into the event or effect that queues the update.
Related rules
More Bugs rules from the rules reference:
react-doctor/no-indeterminate-attribute: Indeterminate checkbox state set as an attributereact-doctor/no-inert-sticky-position: Sticky positioning has no insetreact-doctor/no-initialize-state: Disallow initializing state in an effect.react-doctor/no-is-mounted: Disallow the removed legacy isMounted() API — cancel async work instead of guarding setState.react-doctor/no-jsx-element-type: Widen the return type from JSX.Element to React.ReactNode: function App(): React.ReactNode