Reducers and Pure Functions
One of the core concepts of Redux is the reducer. A reducer is a function with the signature
Array.reducemethod, which iterates over each of the array's items and accumulates a single value as a result. Reducers should be pure functions, meaning they don't generate any side-effects.
A simple example of a reducer is the sum function:
let x = [1, 2, 3].reduce((sum, number) => sum + number, 0);
// x == 6