1.

How do you manage state in a bigger React native application?

Answer»

In React, we follow component driven development, which means that we would be writing several stateful or stateless reusable components and COMBINE them to build the entire application. Where your application is getting bigger then there are many instances where one component wants to ACCESS a state of any other component. One way to achieve this by putting a dependent component as children of the same parent and then can communicate via callbacks. 

These solutions work for small application but for a large application, passing callback from parent to innermost child element is cumbersome. That is where Redux comes in picture. Redux is a POPULAR library to EFFECTIVELY MAINTAIN and manage the state of large React native application. It provides a store which keeps application level state and the developer needs to write actions and reducers to modify the state in the store. Any component can connect with the store by using Redux’s high order component connect. any component can dispatch an action which reaches to the reducer and updates the state in the store.



Discussion

No Comment Found