Home
← All questions

React Strict Mode — why effects run twice

MediumPremiumReact

Asked at Meta · Vercel · Stripe

React interview practice: Explain Strict Mode's double-invocation in development and what it catches.

Answer

<StrictMode> enables extra development checks. In React 18+, it intentionally double-invokes component render and effects (mount → unmount → remount) in development to surface:

  • Missing cleanup in useEffect (memory leaks, stale subscriptions).
  • Non-idempotent side effects (mutating globals on mount).
  • Deprecated APIs (UNSAFE_ lifecycles, legacy string refs).

Production builds do not double-invoke. This is not a bug.

Premium question

Unlock the full model answer with Mentoxis Premium.

Unlock with Premium