useState Hook - React In Depth

  Рет қаралды 2,249

Tech with Nader

Tech with Nader

Күн бұрын

Пікірлер: 27
@aliajellu
@aliajellu 4 ай бұрын
The visual are the BEST part of your explanation. More visual please....
@crisi6754
@crisi6754 Жыл бұрын
This video was a perfect balance of theory and application. I've been using React for 2 years professionally, and this video was awesome to watch. Well done Mr. Nader!
@TechWithNader
@TechWithNader Жыл бұрын
Thank you! It's awesome to hear that even with a bunch of React experience under your belt, you can still get some good takeaways 😊🚀 Excited to see how you do on the exercises as I'll try to make some trickier ones in there 🤓
@AdoptingCode
@AdoptingCode 22 күн бұрын
Love the depth, wish more creators took the time
@Abulkhair1995
@Abulkhair1995 13 күн бұрын
What a Brillant Lesson
@praveenkanwar953
@praveenkanwar953 5 ай бұрын
this lecture was awesome, cleared so many doubts I had
@arfatkazi-h8q
@arfatkazi-h8q Ай бұрын
best video best playlist good work brother😍😍😍😍
@dualasus12
@dualasus12 Жыл бұрын
I've used React and useState quite a bit, and knew about the majority of the trip ups you mentions (passing different references to setStateVariable() for re-renders, as well as the issue with State not updating inside the function body after setState() calls but was never explained exactly why. Which really does make all the difference as opposed to getting hand waved with a "because thats just how it works", and as someone whose dealt with their fare share of bugs due to these 2 things in particular i feel this video would've saved me a lot of time and headaches.
@TechWithNader
@TechWithNader Жыл бұрын
Thanks for the kind words! I'm glad all this comes across as these are exactly what I felt as I learned CS and these concepts, haha! I'm glad the extra details and depth clears things up 😊
@DeepLook1
@DeepLook1 Жыл бұрын
Ur awsome Nader gr8 tutorial the way u teaching I will never forget. ❤❤
@sunnyarora3557
@sunnyarora3557 Жыл бұрын
Happy to see you are working on react series
@raphaelokenyi2138
@raphaelokenyi2138 Жыл бұрын
Loving this React playlist. Thank you
@shadmanzaman435
@shadmanzaman435 10 ай бұрын
Hey Nader! Had a question, how is the count being updated when console.log is called even though we are constantly re initializing count to 0 whenever the button is clicked, (shouldn`t the console display -> 1, 1, 1, 1, 1 ... ) does this have something to do with closures or something? Other than that the video was very helpful.
@TechWithNader
@TechWithNader 10 ай бұрын
Great question! Yup, that's pretty much the main point of using useState. Its goal is to set the initial value (in this case 0), then we provide the function to update it later. The initialization part happens only once, but the update function is what gets called whenever we need to change it. React will keep track of the fact we want it to start at 0, but not reset it each render with useState(0). And indeed you can thing of it like a closure (imagine you have a global map of all the states for each component, their initial values and their updater functions). Hope that helps! 😊
@shadmanzaman435
@shadmanzaman435 10 ай бұрын
@@TechWithNader so if i am not wrong -> as soon as App() is called, inner add function gets attached to onclick event, so even if the App function is run once, the closure function still has access to count and updates it on every click, but the DOM wont be re-rendered as App() already returned its value (button element) and wont rerun, so to resolve this we use useState right?
@TechWithNader
@TechWithNader 10 ай бұрын
@shadmanzaman435 yup, exactly! We could simulate this by creating a global for it or putting it outside App, but that’s exactly what useState does internally for us with some optimizations too 😃 The main thing to remember is the component function always gets re-run to re render so anything inside that function gets created anew unless we use things like globals or closure 🤓
@LuisMateoAriasCaicedo
@LuisMateoAriasCaicedo 9 ай бұрын
Thanks!
@susmithaajob1598
@susmithaajob1598 11 ай бұрын
awesome ....
@maha33612
@maha33612 Жыл бұрын
Thanks alot Its helpful and understandable please make node js and express series also
@TechWithNader
@TechWithNader Жыл бұрын
Thanks! I'm planning a REST API course for sure 🥳
@mnnw148
@mnnw148 Жыл бұрын
you are amazing🤩
@4399lol
@4399lol Жыл бұрын
nice video
@alinanerlich7236
@alinanerlich7236 10 ай бұрын
What if you make count a global variable?
@TechWithNader
@TechWithNader 10 ай бұрын
Good idea! You could, but generally: - globals are generally a bad pattern (lots of bugs and pollutes the namespace) - you would have to create a separate one for each component and track them somehow - lots of other small issues in production... That said, there are globals that exist that are useful, but they usually make sense to be global (eg: console)
@extrabitfree
@extrabitfree 15 күн бұрын
WOW
@BabaloMbulawa
@BabaloMbulawa 6 ай бұрын
Thank you so much this is so useful 💯SIYABONGA
@shehanmaduwantha4795
@shehanmaduwantha4795 Жыл бұрын
Added :)
Exercises: useState Hook - React In Depth
1:10:45
Tech with Nader
Рет қаралды 2,6 М.
#39 Разбираемся в Reconciliation на примерах  - ReactJS Полный курс
36:34
Евгений Паромов | Front-end
Рет қаралды 11 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
JSON Parser 100% From Scratch in Haskell (only 111 lines)
1:50:07
useEffect Hook - React In Depth
1:01:10
Tech with Nader
Рет қаралды 2,3 М.
Introduction to REST APIs - Rest APIs In Depth
21:19
Tech with Nader
Рет қаралды 6 М.
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 100 М.
Don't be THAT backend engineer, EVER
59:17
Sriniously
Рет қаралды 5 М.
React Hooks Crash Course (useMemo, useCallback and more).
31:49
developedbyed
Рет қаралды 88 М.
Learn React useReducer Hook with Examples
14:19
Lama Dev
Рет қаралды 181 М.
Learn to use State in React in 19 minutes (for beginners)
19:29
Sonny Sangha
Рет қаралды 87 М.
Custom Hooks - React In Depth
36:29
Tech with Nader
Рет қаралды 1,2 М.
DNS, IP Addresses & Ports - Rest APIs In Depth
32:16
Tech with Nader
Рет қаралды 2,1 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41