Chapter 2: Crafting States in Functions
In the previous chapter, we learned how to write function components in React. In this chapter, we will craft a special variable called a state in the function components. We will see what benefits a state can bring us, including requesting a new update, making a variable persistent, listening to a value change, as well as performing tasks upon the mount. We will also see an example of applying a state to a single-page application. In the end, we will look closely at what role the states play within the UI.
We will cover the following topics in this chapter:
- Crafting a state in a function component
- Applying states to single-page applications
- How states work with UIs
- Questions and answers