There are many states in an app that will change depending on time, user behavior, or a plethora of different reasons. Thus, if we consider an app as the process to change its own state, the view a user sees is how the states are presented.
For example, in a TODO list app, when we create a new todo item, we actually changed the state of an app from one without that TODO item to one with the TODO item. In addition, because the app’s state has changed, and the view is how a state is presented, we will see the new TODO item in our view.
If an app’s state, unfortunately, does not behave as expected, then it’s time to debug the app. E.g. If we add a new TODO item but our state appears to have added two items instead of just one, we will have to spend time on figuring out which state change went wrong. Sounds pretty simple on paper, right? If you think this process will be easy, you’re too naïve…. Real-world apps are often much more complex, and there are a lot of factors that will make this debugging process a nightmare, such as having a bad coding habit, flaws in the framework design, not investing time in writing unit tests, etc.
Redux’s framework is designed to ease the debugging process. To be more specific, Redux is a framework that extends the ideas of Flux and simplifies redundant things.
How does Redux Work?
- Store: Manages the states. Mainly there is a dispatch method to dispatch an action. In a Redux app, you can obtain its states via store.getState()
- Reducer: Decides how to change a state after receiving an action, and thus can be considered the entrance of a state change. A reducer is comprised of functions, and it changes states by taking an action as an argument, in which it then returns a new state.
- Middleware: The middleman between a store.dispatch() and a reducer. Its purpose is to intercept an action that has been dispatched and modify or even cancel the action before it reaches the reducer.
Arivazhagan on 21st Nov 2017, 09:47 AM
What are the uses of Redux & who use it ?
priyanka_r on 21st Nov 2017, 02:52 AM
Redux is used mostly for application state management. Redux maintains the state of an entire application in a single immutable state tree (object), which can't be changed directly. When something changes, a new object is created (using actions and reducers).
Who use it?
Mattermark - Discover, Research & Prospect Companies - They have a really great platform of Business Intelligence
http://here.com/ - Redux is used by Here (Previously owned by Nokia, now owned by Mercedes, BMW and Audi) in their internal tools, according
Mozilla Payments - They are using it for the UI of the payments service for Mozilla properties or services.