A reducer is a pure function responsible for handling actions and returning a new state based on the previous state and the action that was dispatched.
A reducer is a function that receives the current state and an action object, decides how to update the state if necessary, and returns the new state: (state, action) => newState.
You can think of a reducer as an event listener that handles events based on the received action (event) type.
They should only calculate the new state value based on the current state and action arguments.
They are not allowed to modify the existing state. Instead, they must make immutable updates, by copying the existing state and making changes to the copied values.
They must not do any asynchronous logic, calculate random values, or cause other "side effects" that is they must be pure functions