useReducer is a hook that manages complex state with a reducer function: (state, action) => newState. You change the state by sending actions through dispatch. It is suited when several values evolve together or the transition logic is elaborate; the reducer must stay pure.
Example
const [etat, dispatch] = useReducer(reducer, { n: 0 });
dispatch({ type: 'incrementer' });