Welcome back to the React for beginners series!
In this tutorial, we're going to learn about state in React. State within components allows us to create components that can hold live data that is interactive and flexible. It's a huge part of React, and it's what makes React actually 'React'.
State within each component is represented by one big state object. Any individual pieces of state, which can be created by you, are stored as properties in this large state object. To create a piece of state, we need to use the function useState(). When this function is called, it creates a piece of state in our component and gives us back a variable and setter function that we can use to access and change the state, respectively.
If you found this video helpful, please consider liking the video and subscribing, as it helps me out tremendously! Thanks for the support!
Timestamps:
0:00 - What is State?
3:16 - useState Function
6:06 - Modifying State (onClick)
7:39 - Setter Functions
10:28 - Modifying State (onChange)
Hashtags:
#reactjs #programming #reacttutorial