Once you are done with React Native: Networking, let’s move towards React Native: Redux.
Revival can be broken down into a few segments while building the app which is listed below.
Reducers: Actions define the fact that something occurred, yet don’t indicate how the application’s state changes accordingly. This is the job of reducers. When an activity is dispatched for state change reducers must make the necessary changes to the state and restore the new state of the application.
Activities and Actions Creator: “Activities and Action Creators are payloads of data that send information from your application to your store. They are the only source of data for the store.” this implies if any state changes necessary the change required will be dispatched through the actions.
In Redux, an action creator is a function that restores an action object. Action creators can appear to be a superfluous step; however, they make things more mobile and easier to test. The action object that came back from an action creator is sent to all of the different reducers in the application.
Contingent upon what the action is, reducers can select to restore a new version of their place of the state. The newly returned piece of state that gets channeled into the application state, which then gets funneled over into React application, which then causes all of our component re-render.
Here is the sample of action creator:
Furthermore, here is the simple reducer that manages the action of type ADD_TODO:
Store: Store with the assistance of reducers a store can be made which holds the whole state of the application it is suggested to use a single store for the whole application than having multiple stores which will violate the utilization of redux which just has a single store.