In this chapter, a global state management pattern with React Hooks will be discussed.
There are many situations for developers while working on React projects where it was required to share the same state in a number of React components. React documentation provides insights into the concept of “lifting state up.” There are benefits and drawbacks to this approach. It works well within one feature but when sharing state between multiple features, it can quickly become messy with a number of props being passed around. Secondly, it becomes difficult to debug the code if issues arise. This is where it makes sense to define a global state so that various features can access the same data at any given time.