React useState Hook | Learn ReactJS

  Рет қаралды 31,529

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 44
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Learning the React useState hook is your first step towards learning about and managing state in React. Working with state requires you to think in a React-ful way which is different than Vanilla JS. That said, you should be familiar with Vanilla Javascript before learning the differences provided by React. If you are new to Javascript, I suggest beginning with my 8 hour full Javascript tutorial here: kzbin.info/www/bejne/e5eknWyYrN-JkM0
@toonice555
@toonice555 Жыл бұрын
Been using react for a while now and going through these videos really helped me understand certain things on a deeper level!
@BrainNotUsed
@BrainNotUsed 3 жыл бұрын
Cannot wait to catch up! I have yet to start your React series as till now I was progressing my Vanilla JavaScript knowledge. You are an amazing tutor!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Thank you so much! 🙏💯
@Sean-hd1bp
@Sean-hd1bp 3 жыл бұрын
This is the best explanation of useState I could find. Nice one!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Thanks Sean! 🙏💯
@yardleyfrausto7612
@yardleyfrausto7612 4 ай бұрын
Im learning react now and I am so glad I came across this channell
@quasi_verum
@quasi_verum Жыл бұрын
4 years ago, I have really struggle to understand state concept. apart from class component concept, there aren't many creators who make content like you, Dave. It took me 2 week to figure out all about this.state, this.setState()(and all form of state mutation, and callback parameter), this.handleEvent.bind(this). Haven't hit componentDidUpdate yet. Thank you dave, at least there are a lot people that not struggle to understand hook useState.
@daman823
@daman823 Жыл бұрын
Tese tutorials are awesome !! Keep going 🎉
@zakariachajia1199
@zakariachajia1199 7 ай бұрын
amazing video learned things in a new way still eager to finish this laylist
@immortalaigs4203
@immortalaigs4203 3 жыл бұрын
i ended this tutorial! everyday 2 lessons i am learning :).
@dror-krief
@dror-krief 8 ай бұрын
Thank you, Dave
@aman7555
@aman7555 2 жыл бұрын
Excellent content as always!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you! 🙏
@ruebenhales8558
@ruebenhales8558 2 жыл бұрын
Great job explaining Dave thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad it was helpful! 💯
@mubirujamesbenjamin3440
@mubirujamesbenjamin3440 Жыл бұрын
Thank you. You're the best
@faisalejaz3893
@faisalejaz3893 Жыл бұрын
Dave you are great
@ahmedalsayeh5837
@ahmedalsayeh5837 Жыл бұрын
thankYOU
@jizzervirusreptikonski8756
@jizzervirusreptikonski8756 2 жыл бұрын
I think that count part should have been explained with reloading the page
@amulsharma564
@amulsharma564 4 ай бұрын
Was looking for some better tutorial for React, Came across this "The Best Tutorial For React".
@pranjalruhela1103
@pranjalruhela1103 7 ай бұрын
the handlickick logs 0 because of the asynchronous nature of the setstate function. THe thing is that the code on the next lines are batched and kept aside while the program keeps on going and on the rerender the new state reflects but by that time console has logged the old value.
@samiullahsheikh5015
@samiullahsheikh5015 2 жыл бұрын
Can you please explain the difference between these two? setValue( value + 1) VS setValue((prevValue) => prevValue + 1)
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Yes, you want this video on that topic: kzbin.info/www/bejne/r6e3eIt-bNqsmKM
@jamshidtashkent1976
@jamshidtashkent1976 2 жыл бұрын
Really helped
@utkarshp1108
@utkarshp1108 2 жыл бұрын
avoiding mistakes part is working in my computer I've got 1 and after that added one more count+1 I've got 2
@harag9
@harag9 Жыл бұрын
The gotcha for the adding of +1 and +1 to the count I can see getting loads of people. me included, it just doesn't make sense when you are reading line by line. IF you wanted to use the NEW updated count after adding the +1 to it at line 14, how do you do that? Can you do that? Would have been nice if you answered that question. Though it's good to know about the gotcha.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
I think this deeper dive will help answer your question: kzbin.info/www/bejne/r6e3eIt-bNqsmKM
@harag9
@harag9 Жыл бұрын
@@DaveGrayTeachesCode Thanks for the link to the video. I'll check it out.
@psyferinc.3573
@psyferinc.3573 2 жыл бұрын
your awesome dude
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you!
@aya2222
@aya2222 2 жыл бұрын
In handleClick function, the update of 'count' is asynchronous. That's why console.log(count) doesn't display updated 'count'. Is it right explanation?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
React does batch updates of state. The state variable retains the same value from when the component loads each time. Instead you must use a function in setState to pull in the previous state. It's a bit complicated to explain, but I provide another tutorial on it where the examples should do so nicely here: kzbin.info/www/bejne/r6e3eIt-bNqsmKM
@ghostpieces2362
@ghostpieces2362 3 жыл бұрын
Is this tutorial. When using setCount(count + 1), if you wanted to access the update count in the same function is that possible?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Good question! I explain the answer to this exact question in this follow up tutorial: kzbin.info/www/bejne/r6e3eIt-bNqsmKM
@CAPS_AMERICA
@CAPS_AMERICA Жыл бұрын
I got lost in setCount(count + 1). If count variable is a constant and setCount is the setter, isn't the same as passing setCount(0+ 1) which would set getter variable to 1 (count), the console.log(count) will be 1? Not sure I'm getting the logic here. You're calling setCount function first, console.log function comes next, why would the state of count unchanged when you've already set it to count + 1? Is there some kind of lazy loading where variable values are loaded even BEFORE calling a function in React?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Good questions and the answer has to do with rendering and batch updates. Explained in greater detail here: kzbin.info/www/bejne/r6e3eIt-bNqsmKM
@skillkrio
@skillkrio 2 жыл бұрын
I didn't got any job so far. If i got any my first job is to support you .
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Keep going! And thank you!
@DawinderSinghGhanauri
@DawinderSinghGhanauri 2 жыл бұрын
code download link ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
There is not one for this specific lesson, but all download links for this series are found here: github.com/gitdagray/react_resources
@smithasilviadsouza
@smithasilviadsouza Жыл бұрын
count state is getting changed for me
@trieudien1990
@trieudien1990 2 жыл бұрын
good
@TravinskiyVladislav
@TravinskiyVladislav 2 жыл бұрын
Top
React JS Lists and Keys | Learn ReactJS
32:54
Dave Gray
Рет қаралды 39 М.
React JS Props and Prop Drilling | Learn ReactJS
25:54
Dave Gray
Рет қаралды 35 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
CSS Styles in React JS | Learn ReactJS
7:29
Dave Gray
Рет қаралды 37 М.
React useEffect Hook tutorial | Learn ReactJS
11:47
Dave Gray
Рет қаралды 24 М.
React App Component and JSX | Learning ReactJS
11:49
Dave Gray
Рет қаралды 38 М.
JSON Server Rest API | React Dev Server | Learn ReactJS
6:34
Dave Gray
Рет қаралды 34 М.
Fetch Data from API in React JS | Learn ReactJS
23:40
Dave Gray
Рет қаралды 40 М.
React JS Forms | Controlled Inputs | Learn ReactJS
37:32
Dave Gray
Рет қаралды 38 М.
React CRUD Operations | Learn React JS
20:22
Dave Gray
Рет қаралды 33 М.
Introduction to React JS | ReactJS Setup and Resources
13:24
Dave Gray
Рет қаралды 127 М.