const initialState = { count: 0 }; function reducer(draft, action) { switch (action.type) { case "increment": return void draft.count++; case "decrement": return void draft.count--; } } function Counter() { const [state, dispatch] = useImmerReducer(reducer, initialState); return ( <> Count: {state.count} ); }