---
type: video
yt_id: VVU2YVRMdUlfajQtMHdpRFN6bWFQY3RRLl93UEdjcG9aUW44
videoId: _wPGcpoZQn8
title: "useState"
date: "2022-09-19T14:00:18Z"
slug: "usestate"
image: 
  name: "usestate.jpg"
  alt: "useState"
  width: 1280
  height: 720
status: 'published'
description: "Learn how to use useState in a react app to:"
tags: ["react", "useState", "hooks", "javascript"]
---

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](https://github.com/Sam-Meech-Ward/react-state-jokes)

🔗Final Code:
[https://github.com/Sam-Meech-Ward/react-state-jokes/tree/finalCode](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](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](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


