State Management

The "state" describes the condition of an application at a given time. In a way, the UI is the visual representation of the state of an application. The UI must therefore be updated when the state is updated. State change is primarily due to user interaction.

React takes care of re-rendering the UI when the state is updated. To that aim, React has a "Reconciliation" process with an efficient "Diffing Algorithm." Thus, you don't need to worry about updating the UI. Instead, you should focus on the logic and process of managing the state.

Unfortunately, React falls short when it comes to state management. The latter is a broad term that describes how you store the state and how you change it. In response to the shortfall of React in state management, the community created many third-party state management tools such as Redux, MobX, Recoil, XState, Akita, Hookstate, Jotai, Zustand, and many more!

We don't use any of these libraries in this course. However, you may want to explore these on your own.