New
Introducing React Bench, see how different models perform on React code

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.

More Bugs rules from the rules reference: