Patterns
Split state and dispatch contexts
Expose model state and stable reducer dispatch through distinct context objects when consumers have separate needs.
Formal Syntax & Structure
react syntaxreact
<StateContext value={state}><DispatchContext value={dispatch}>{children}</DispatchContext></StateContext>Working Example
Example Snippetreact
const [density, dispatch] = useReducer(settingsReducer, "comfortable");