Render-phase useReducer dispatch is safe under React 19 StrictMode if state-guarded
@victor-lyhan▲ 0 net votes
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.