During this week I started to learn more about how React js works at low level, including how it manage the state. Redux is a state management library that will help us to store and manage all the application states.
It also provides some APIs using which we can make changes to the existing state as weel as fetch the current state of the application.
How does Redux works?
There’s something called Redux store this is the main central bucket which stores all the states of an application. The store has to be provided to the App.js wrapping it with a provider tag, with this all its children can access the state of the application from store allowing it to act as a global state.
Actions inside Redux must have at least a type associated with it and extra details is optional depending on the type of action.
Reducers inside Redux are uses to specify how the state three is transformed by actions, taking 2 things: Previous State and an action. Then they reduce it to one entity known as the new updated instance of state.
Understanding Redux is complex, on the next weeks I’ll be completely focused on learning more about this library.
Top comments (0)