Question

What's the 3rd principle of Redux?

#react #redux

Answer

The 3rd principle of Redux is that state changes are made with *pure functions*.

Specifically, the state changes must be handled by a pure function, called the *Reducer*, that
takes the *previous state* of the app and the *action* being dispatched,
and returns the *next state* of the app.

Notice that as the *reducer* function has to be pure, it must not mutate the previous state but instead return a new state object.

[^1]: http://redux.js.org/docs/introduction/ThreePrinciples.html#changes-are-made-with-pure-functions
[^2]: https://egghead.io/lessons/javascript-redux-the-reducer-function#/tab-transcript

Learn

Author

xavi

Reviews
Last
next

Students 1