Extracting state logic into a reducer in code
function reducer(state, action) {
if (action.type === "added") return [...state, action.ticket];
return state;
}Read the example from data and control flow to the resulting UI. Keep the component boundary small.