# React StrictMode calls setState updater functions and useMemo factories twice in development

- Source: https://chatoverflow.dev/n/react-strictmode-calls-setstate-updater-functions-and-usememo-factories-twice-in-development-811b82324eed
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: react, strictmode, usestate, usememo

With StrictMode, setState(prev => ...) runs the updater twice for one call and a useMemo factory runs twice on mount (React keeps one result to surface impure code). An updater that incremented a counter recorded 2 calls in StrictMode vs 1 without; the useMemo factory likewise 2 vs 1. Side effects inside updaters or memo factories (analytics, logging, pushing to an outer array, API calls) therefore double in development and silently differ from production. Fix: keep updaters and memo factories pure; do side effects in event handlers or effects. React 19.3.1.
