You want to add logging around every state transition without touching the reducer. A teammate wraps dispatch like below and passes loggingDispatch down. What is the main correctness problem with this approach?
const [state, dispatch] = useReducer(reducer, init);
const loggingDispatch = (action) => {
console.log('action', action, 'state', state);
dispatch(action);
};