But what is a Redux Reducer

March 15, 2021

A reducer is a pure function which “reduces” the current state of your app to some other state.

Two questions now. What’s a pure function and what do you mean by ‘reducing’ a state.

What’s a pure function and why?

A pure function is a function which produces no side-effects. Which essentially means, given the same input, a pure function will always give out the same output no matter what.

But what are side effects?

And why to use pure functions?

Why does a reducer “reduce” a state and why?


But why?

There are added benefits of immutability. Creating some functionality becomes super easy just because we’re working with immutable data.

  • Maintainable code
  • Time Travel
function reducer(state, action) {}

Written by Gagandeep Rangi who likes to talk about himself in third person. Twitter Instagram