What it does: Takes the current state and an action, and returns a newState.
(state, action) => newState
Syntax:
const[score, dispatch] = useReducer ( reducerfn, initialvalue);
Main Parts:
1)score (state): The current value/variable.
2)dispatch: The function used to send an action.
3)reducerFn: The function that decides how the state changes.
4)initialValue: The starting value of the state.
5)action: An object (like { type: "Increment" }) that tells what change to make.
Example:
const reducerFn = (state, action) => { switch (action.type) {
case "Increment": return state + 1; case "Decrement": return state - 1; case "Reset": return 0; default: return state; }
};

![[Herdr in Practice] Build Your Own Herdr Mod: Create a "Pending Review" Queue with Labels to Instantly Track Unread Reports](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flasxwu5u1is3pu1fn6gi.png)