How do React Hooks really work? Let's build useState from scratch!

  Рет қаралды 10,889

Jacques Blom

Jacques Blom

3 жыл бұрын

Have you ever wondered how exactly React hooks work under the hood, and why they have the rules that they have? In this video we're going to answer those questions, by building our own useState hook completely from scratch. Let's get coding!
👍 And remember to smash that like button! 💥
----------------------------------------------------------------------
💌 Subscribe to my newsletter to be the first to know when I release new content, and for exclusive content: jacquesblom.com
----------------------------------------------------------------------
🌐 Links
The starter code: github.com/jacques-blom/react...
Swyx's Egghead lesson: egghead.io/lessons/react-conc...
----------------------------------------------------------------------
🐦 Follow me on Twitter: / jacques_codes

Пікірлер: 30
@JacquesBlom
@JacquesBlom 3 жыл бұрын
Thanks so much for watching! 🙏 Feel free to leave any questions in the comments below and I'll do my best to get back to you. 💌 Also be sure to subscribe to my newsletter to be the first to know when I release new content, and for exclusive content at jacquesblom.com​
@SilvioAmon
@SilvioAmon 2 жыл бұрын
Finally someone was able to explain this well!
@matheusviniciusandrade2733
@matheusviniciusandrade2733 2 ай бұрын
One of the most interesting videos that I have ever seen.
@ayush--gupta
@ayush--gupta 10 ай бұрын
This is not what I was looking for, but i am very thankful this much clearity of explanation. Really appreciate.
@santhoshj4081
@santhoshj4081 Жыл бұрын
This is a great video, very well presented, thank you so much!
@ChandrikaChenna
@ChandrikaChenna Жыл бұрын
Super!! Very useful
@niketanjha
@niketanjha 2 жыл бұрын
Awesome ❤️ Subscribed.
@electrotsmishar
@electrotsmishar 11 ай бұрын
thanks so much. very useful information
@chandrapriya6618
@chandrapriya6618 2 жыл бұрын
Really wonderful!! Helped me in a state of confusion
@ayush612
@ayush612 2 жыл бұрын
Amaziiiiiingggg!!!! Thanks Jacques..so insightful!
@pieter5466
@pieter5466 10 ай бұрын
Great video, helps understand certain things many devs might take "as given".
@saienrique
@saienrique 2 жыл бұрын
Dude u got very good presentational skills. U will rock. keep posting videos.
@chrisschuller7055
@chrisschuller7055 2 жыл бұрын
Awesome video! So many people are just writing the code without explaining the last little bit of why you have to call the render method in the end. Now I understood how it works! :D
@SaidElnaffar
@SaidElnaffar 2 жыл бұрын
I watched more than 3 videos and admittedly this is the most elegant code ever!
@abdelazizlaissaoui9079
@abdelazizlaissaoui9079 7 ай бұрын
Great video we have just seen Great content creator
@SouravRakshit_srv
@SouravRakshit_srv 3 жыл бұрын
too good😲 never had such deep dive into react, will definitely check the recoil content now
@JacquesBlom
@JacquesBlom 3 жыл бұрын
Thanks, Sourav!
@michelreyes7375
@michelreyes7375 3 жыл бұрын
Thanks 😊 I also follow you on Learn Recoil and the way you explain make it thinks look easy-going.
@JacquesBlom
@JacquesBlom 3 жыл бұрын
Thanks so much, Michel!
@rudboi
@rudboi Жыл бұрын
Why does calling "renderApp" work inside setState? Aren't function expressions not hoisted? Or does it reside in memory after the first "render" ?
@kellothermes9039
@kellothermes9039 2 жыл бұрын
I'm having trouble understanding why we need to freeze the currentIndex. Every time we re-render the App component the index would be set to -1 and then useState will be called twice. So, the call index would be 1 again. What is the point of setting the callIndex to -1 for every re-render? Could someone please explain it to me?
@infocampus5043
@infocampus5043 Жыл бұрын
does ur useState accept prev=>prev+1 ??
@alexgavril385
@alexgavril385 4 ай бұрын
🎉
@RandomGuy-jv4vd
@RandomGuy-jv4vd 2 жыл бұрын
I'm just getting into React and i have this considerably naive question: why does setCount(countA + 1) works but not setCount(countA++) or setCount(++countA) ?
@negenalamjiyn6637
@negenalamjiyn6637 5 ай бұрын
Still don't know or should I explain as I understand?
@RandomGuy-jv4vd
@RandomGuy-jv4vd 5 ай бұрын
@@negenalamjiyn6637 now looking back after 2 yrs, and have better understanding of the JS closure, I think a more appropriate setState in this case should be `setCount(prevCount => prevCount + 1)`
@allenjr4978
@allenjr4978 2 жыл бұрын
At 2.00 why are you declaring outside the function why not inside the function?
@SaidElnaffar
@SaidElnaffar 2 жыл бұрын
He is right. At 2:00 he should declare the index and the array outside the useState function because they are global and common over the multiple calls of useState. If inside, then they will be re-initialized each time the useState is called, which is wrong.
@_Aries96
@_Aries96 8 ай бұрын
i can't understand. so fast for me
@Sirgaz
@Sirgaz 5 ай бұрын
Doesn’t usestate use closures
What's New in Recoil 0.2.0
10:29
Jacques Blom
Рет қаралды 1,7 М.
Learn useState In 15 Minutes - React Hooks Explained
15:45
Web Dev Simplified
Рет қаралды 1,1 МЛН
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 40 МЛН
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 13 МЛН
Joven bailarín noquea a ladrón de un golpe #nmas #shorts
00:17
How a React App Works Under the Hood
14:18
PortEXE
Рет қаралды 56 М.
How Do React Hooks Actually Work? React.js Deep Dive #3
14:15
Philip Fabianek
Рет қаралды 27 М.
6 State Mistakes Every Junior React Developer Makes
15:53
Lama Dev
Рет қаралды 262 М.
React useState() hook introduction 🎣
16:33
Bro Code
Рет қаралды 16 М.
This is Why You Can't Render React Hooks Conditionally
13:04
JavaScript: How It's Made
10:54
Fireship
Рет қаралды 867 М.
The important things to know about React state and renders
18:33
Web Dev Cody
Рет қаралды 25 М.
📱 SAMSUNG, ЧТО С ЛИЦОМ? 🤡
0:46
Яблочный Маньяк
Рет қаралды 1,6 МЛН
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 4,3 МЛН
AMD больше не конкурент для Intel
0:57
ITMania - Сборка ПК
Рет қаралды 456 М.
iPhone 15 Pro vs Samsung s24🤣 #shorts
0:10
Tech Tonics
Рет қаралды 8 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 11 МЛН