intermediate

Strict Mode

Use development-only checks to expose impure rendering, missing cleanup, and unsafe assumptions.

`<StrictMode>` enables extra development-only behaviors: double-invoking renders and effects to expose impure render logic and missing effect cleanup. It does not run twice in production builds.

Treat remounted effects as a signal to write idempotent setup and teardown. Deprecated API warnings also surface here. Strict Mode is a diagnostic wrapper, not a runtime feature users toggle in production.

If an effect subscribes twice in dev, ensure cleanup mirrors setup — unsubscribe, abort fetches, clear listeners.

On interviews, explain the concept with a concrete example and name the behavior interviewers probe.

Common pitfalls include hiding data flow, over-splitting components, and putting side effects in render.

The trade-off is often clarity versus reuse or explicit props versus convenience.

Checklist:

  • Write effects safe to mount/unmount twice in dev.
  • Keep render pure despite double render.
  • Do not rely on Strict Mode in production.