What is useState in React

2 years ago
7

In this React tutorial I will explain what useState() is and how to use the useState( ) hook in React js. The useState() is a Hook that allows you to have state variables in functional components .
useState Syntax:
The first element is the initial state and the second one is a function that is used for updating the state.

const [state, setState] = useState(initialstate)

🎱Source Code for this Video:
https://norbertbm.com/what-is-usestate-in-react/
-----------------------------------------------------------------------------

👇 Website & Courses: 👨‍🏫 :
https://norbertbm.com/web-development/web-dev-courses/

Podcast:
https://www.youtube.com/channel/UCDKBcl1m__Oj7C5O-orhn_w
-------------------------------------------------------------------------------------------------
Timestamps:
00:00 - Intro & Project overview
00:34 - How to install react
02:55 - Example using vanilla JavaScript
03:53 - Prevent default behavior of forms
05:00 - How to use variables in React
05:54 - how to use functions in React
06:33 - using events in react
08:14 - change the value of a variable using regular javascript in react
09:32 - how to import useState in react
10:26 - How to use useState in React
13:06- How to chage state in React

------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------

#useState #reacttutorial #norbertbmwebdevelopment

Loading comments...