Using the State Hook
After learning about the principles of React and giving an introduction to Hooks, we are now going to learn about the State Hook in depth. We will start by learning how the State Hook works internally by reimplementing it ourselves. Doing so will teach us about the limitations of Hooks and why they exist. Then, we will learn about possible alternative Hook APIs and their associated problems. Finally, we will learn how to solve the common problems that result from the limitations of Hooks. By the end of this chapter, you will know how to use the State Hook to implement stateful function components in React.
In this chapter, we are going to cover the following main topics:
- Reimplementing the State Hook
- Potential alternative Hook APIs
- Solving common problems with Hooks