Introduction
A React component is made up of props and state. The state can be local or global. Usually, the local state is handled within the component using the setState method in class components and hooks in the functional components. But as the application grows, the state is usually required to be shared among multiple components. The global state is managed using third-party libraries such as Redux.
Redux works perfectly but setting up redux is complicated and working with it is more complicated. So for moderate global state management, we can use Context API or the useReducer hook. But, there is one more way for managing the global state and that is by using the Context API and useReducer together.