The quest for the ideal React state management is one of the most discussed topics in the React community. If you look around, you will often come across the following question: How do I manage my state in React?
- What is State Management?
- What does state mean in React?
- Is there an official / recommended state management solution like other frameworks in React?
- So how does one choose the appropriate state management solution?
- Context API + State hooks
- Server-State (react-query, Apollo, swr).
- Redux et al.
Especially devs who previously worked with other frameworks like Angular or Vue ask themselves how to manage their state in React. Often the question comes about an official solution for state management.
Another question devs have been asking since the introduction of the Context API and Hooks API in React 16.8 is deciding between Redux or the Context API with useState/useReducer to manage its global state.
I would like to answer both questions in the following. For this purpose, I did some research in the community and got the opinion of many experienced React developers.