O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changes are made with pure functions

The idea of a pure function comes from functional programming, and can be summarized as follows:

  • Given the same arguments, a pure function always returns the same result
  • Regardless of our application state, a pure function is able to execute
  • Variables outside of a pure function's scope cannot be modified by it

These three principles correlate with three major parts of the Redux ecosystem: actions, reducers, and store.

Actions are how we can indirectly modify our read-only state. Reducers are the pure functions that perform that modification. The single store in Redux is where our state exists.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required