What is Redux?
In a previous blog I covered the history of React and the key features it brings to the table, take a look here if you need a refresher. Today I will be covering Redux, and the benefits it can provide to your applications. Redux was created in 2015 by Dan Abramov and Andrew Clark and by design it is typically only to be used when you’re having trouble fitting all your logic into vanilla React.
Or should I say a better state management, this it the biggest pro of using redux. Most people recommend making the jump from React to React with Redux when keeping track of the state logic becomes too difficult. Generally this is only seen with larger applications. Let’s dive a little deeper and see how Redux manages the state efficiently.
State Is Read Only: The state can only be changed by writing an action, which is an object that describes how you will change the state. These actions are all logged which makes debugging easier if an error were to arise.
Single Source Of Truth: State logic is not dispersed all throughout your application, instead it is all stored in… the store. Which is an object in Redux that contains your entire applications state.
Reducers: These are functions that take in the previous state, assess an action and update and return the state accordingly.
The reducers always return a new state every time, which can lead to an excessive amount of memory used.
There is a lot of boilerplate code, which can be a con for those who enjoy having full control of their code.
Ultimately you have to know when to use Redux, and just because it was built for React it can still be used with other UI layers like Vue, Angular, React Native and more.
Why use Redux? A tutorial with examples - LogRocket Blog
Editor's note: This React Redux tutorial was last updated on Jan. 28, 2021 to include a section on Redux middleware and…
General | Redux
Why Use React Redux? | React Redux
Redux itself is a standalone library that can be used with any UI layer or framework, including React, Angular, Vue…