CodeIntermediate

Reducer

Also known as state reducer · Redux reducer

A function that calculates an accumulated or next value from the current value and an input; state reducers commonly use the previous state and an action.

In the real world

function reducer(state, action) { return action.type === 'increment' ? state + 1 : state; }

Related

Go a little deeper