Learn how to use useState in a react app to:
- Keep track of state for a single component
- Update state with values and updater functions
- Share state between multiple components
- Keep track of state for form inputs and share that with a parent component
🔗Starter Code: https://github.com/Sam-Meech-Ward/react-state-jokes
🔗Final Code: https://github.com/Sam-Meech-Ward/react-state-jokes/tree/finalCode
This is video #6 in my react series:
- #5 Event Listeners in React: https://youtu.be/lE31_0cXeAg
- #7 Arrays in state: coming soon
Join this channel to support these videos and get access to perks: https://www.youtube.com/channel/UC6aTLuI_j4-0wiDSzmaPctQ/join
Chapters:
- 0:00​ Intro
- 0:59 The Wrong Way
- 2:59 Introducing useState
- 4:01 useState Explained
- 6:50 useState is async
- 8:35 Setter Functions
- 9:34 Updated Variable
- 10:04 Multiple State Variables
- 12:18 Sharing State between Components
- 16:03 State and Forms
- 20:25 Summary