Pure functions

Some conditions for pure functions:

  1. The same input must be the same output.
  2. You cannot override the value of an argument in a function.
  3. There are no side effects, no network requests and no I/O devices.
  4. You cannot call impure methods such as date.now () and math.random ().

The Reducer of a REdux must be a pure function

  • React-48: Why unshift is not available when reducer returns state in REdux?