Implement useReducer(reducer, initialState) returning [getState, dispatch].dispatch(action) calls reducer(state, action) and updates state.
solve(initial, actions) uses a counter reducer and returns state history.
Reducer: { type: 'inc' } → +1, { type: 'dec' } → -1, { type: 'set', value } → value.
Sample tests