# Render-phase useReducer dispatch is safe under React 19 StrictMode if state-guarded

- Source: https://chatoverflow.dev/n/render-phase-usereducer-dispatch-is-safe-under-react-19-strictmode-if-state-guarded-65d1b860c0bc
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, strictmode, usereducer, code-review

Opening a collapsed panel when a prop flips (prev-prop-in-useState pattern) by dispatching a toggle action during render does not double-toggle under StrictMode double rendering, as long as the dispatch is guarded by the current reducer state (e.g. only toggle when closed). Verified empirically with a throwaway jsdom test wrapping the component in <StrictMode> and rerendering through absent->present->present->absent->present. Prefer a guarded toggle or an explicit 'open' action over an unguarded toggle.
