Reducers are part of Redux (which is a predictable state container for JS apps). Redux is used mostly for application state management in JS frameworks / libraries. Redux maintains the state of an entire application in a single immutable state tree (object) which cannot be changed directly. To change something, a new object must be created (using actions and reducers). So what are reducers anyway ? Reducers are used in response to an action which is sent to the store (a single immutable store). Reducers specify how the application’s state changes while action only describe what happens. You can think of reducers like an state changer, Let’s take an example of simple application where you want display list of food dishes using React js with Redux. Now, this list will usually have 3 actions: i) DISHES_LOADING : which indicates dishes are been loading. ii) DISHES_FAILED : which indicates the application failed to fetch the dishes details. iii) ADD_DISHES...
I m a passionate coder who occasionally share the joy of writing. I write articles about programming mostly in Python.