Web Developer

Loading

Redux

Redux is a JavaScript library that helps manage an application’s state in web development: 
 
 
  • Centralized state: Redux stores the state of an application in a single global object called the Store. 
     
     
  • Predictable updates: Redux uses rules to ensure that the state can only be updated in a predictable way. 
     
     
  • Easy to test: Redux helps write code that’s predictable and testable. 
     
     
  • Works with any UI layer: Redux can be used with any JavaScript framework or library. 
     
     
  • Debuggable: Redux DevTools make it easy to trace how the state of an application changes. 
     
     
Here are some other features of Redux:
  • Undo/redo: Centralizing the state and logic enables capabilities like undo/redo.
  • State persistence: Centralizing the state and logic enables state persistence.
  • Large ecosystem of addons: Redux has a large ecosystem of addons. 
     
     
Redux works by: 
 
 
  • Actions: The UI triggers events called “actions” to describe what happened. 
     
     
  • Reducers: Separate update logic called “reducers” updates the state in response. 
     
     
  • Reducer function: A reducer function accepts the current state and returns either the new state or the original state. 
     
     
  • Dispatching actions: You can dispatch an action to increment the value of the state.