Тёмный

useReducer is BETTER than useState | React Hook useReducer Tutorial 

Dave Gray
Подписаться 338 тыс.
Просмотров 65 тыс.
50% 1

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 286   
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
The useReducer React hook seems more complicated at first, but after you learn how to use it, useReducer really simplifies state management compared to tracking many different pieces of state that are all implemented with the useState hook. Once you learn about the useReducer hook, I think you will agree! Just getting started with React? If so, I recommend starting with my 9 hour full course React tutorial here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RVFAyFWO4go.html
@Tajdev
@Tajdev 2 года назад
You have not demonstrated how to pass it to component. Please also make video of it.
@m1dway
@m1dway Год назад
@@Tajdev just pass it in an input parameter. Ex:
@minimumt3n204
@minimumt3n204 Год назад
Showing how its similar to useState and rewriting it using useReducer makes it so much more clear! Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome!
@andrews13
@andrews13 Год назад
Tried many tutorials for learning useReducer, but got confused more only. Finally I found this video which is the perfect one!! Simple, great & straight forward!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad I could help!
@jingli9232
@jingli9232 Год назад
the best tutorial for useReducer, super clear and simple to understand, what a teacher!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@pablocodeglia
@pablocodeglia 2 года назад
What a great and easy-to-get explanation for a pretty confusing topic. Excellent work, thanks Dave!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful!
@SagarKumar-db2xy
@SagarKumar-db2xy 2 года назад
Hands down the best tutorial. I am writing this comment after watching maybe 20+ videos and that too from top youtubers, but no one really simplified this much. I just have a request, please make a medium size project using useContext for global state management and useReducer to change them. Pls.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Sagar! I appreciate the request, too. I do need to post some projects. 🙏💯
@zb2747
@zb2747 Год назад
Best tutorial and explanation I found - thank you Dave!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@internetdrew
@internetdrew Год назад
There are a lot of great people teaching these subjects but wow you just made that simple. I just built a fullstack app and most the hold up was micromanaging pieces of state. Going to implement useReducer from here forward.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@verydifferentthought
@verydifferentthought Год назад
I was really having the problem of Redux stuff... But now I can understand where idea of Reducer came from but also dispatch, action and payload which looks like complicated stuff but after your explanation and I got the whole point of the thing. I am grateful of your amazing work from Uzbekistan !
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome and hello 👋 to Uzbekistan!
@arungrg
@arungrg Год назад
Felt so much like small scale Redux. Loved how you explained everything. Great job 👍
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@ssj1260
@ssj1260 Год назад
It's gotten to the stage where, if i'm unsure about something I just type in "question + Dave Gray" to youtube. You have no idea how amazing it is to have a reliable source of information, when I was researching closures I came across so much conflicting information, after your video on them I vowed to make sure I looked at your videos as the main source of truth, they are clean, efficient, well explained and professional. Thanks Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
That's the best compliment I could ask for! Thank you! 💯
@maxwellosuji4096
@maxwellosuji4096 2 года назад
Thank you very much sir. I’ve been having difficulties learning the useReducer hook. I get more confused reading articles and watching other videos. But thankfully You’ve explained and broken down the what, why and usage of this particular hook. I’m so grateful it’s a thumbs up for me👍
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful! 💯
@dzentsetsu5607
@dzentsetsu5607 2 года назад
Very good tutorial yet again Dave! Just want to say it out loud, you really make me a better programmer with every new video. And I have a suggestion for a video... You see it really hard to grasp React for a beginner (even though I came with a diff prog. language experience) because it's so not intuitive and have so many caveats in developing process, SO it would be really helpful and useFull for us beginners if you could explain React pipeline in a tutorial video. For example, how React batching works (again basics), how component initially renders, how and why it re-renders... name a few. After watching your tutorial about calling useState twice in a row and not using prev => !prev was eye opening, but on another hand new question a raised why it working that way... Another example => I didn't know that React recreates a function and ALL inside it when state/prop updates. I think beginners will praise you for such a tutorial. Anyway, thank you so much again!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you and thanks for the suggestion! 🙏💯
@taosit5282
@taosit5282 2 года назад
Yeah exactly! I don’t know how React really works and few people bother to explain it. I’m able to use hooks and make it work somehow but that’s just improvising most of the time. When the problem I face goes beyond the typical tutorial problems, I constantly add new hooks to fix the issues that the existing hooks create, without knowing why I even need the hooks I just added. I often find myself writing 10 useStates and 5 useEffects to coordinate the states within a single component. I’m often exclusively using hooks because I can’t be sure if local variables and functions would have worked. If they do, my code would have been so much easier to read and to maintain. A tutorial on React pipeline would be very useful!
@try-b2k
@try-b2k Год назад
I was having problems in learning reducer from a week or so and this video changed evrything, thanx a bunch
@BrainAido
@BrainAido Год назад
Buddy i am probably very late, as i now just started my interest in React ( company switched to some React based CRM ) , i came to thank you X milions for putting together this video, i finally understood state and it ticked in my head as now you gave me a visual representantion in my brain, please accept my thanks i wish you the best.
@leoMC4384
@leoMC4384 2 года назад
Great content. I implement useReducer in my project for a form that fetches values from my API to several menus, the user chooses data from the menus and the UI gets updated and the entire form data it's validated at the same time. With useState, it got pretty messy. Now with useReducer it's much better, even though my reducer function got quite long. 😀😀😀
@CottidaeSEA
@CottidaeSEA 2 года назад
Thankfully the work in your reducer can also be delegated to separate functions.
@jonathanmcgee654
@jonathanmcgee654 6 месяцев назад
Amazing. I was really lost in why and how to transition from useState to useReducer. Dave walks us through it step by step! Great examples and explanations! Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 6 месяцев назад
Glad it was helpful!
@purushottamkute7485
@purushottamkute7485 Год назад
I'm literally in tears I watched so many tutorials of useReducer but this one is hands down the best one
@El_kammex
@El_kammex Год назад
Now I Understand more what we need useReducer hook. Great job.
@kaioqrz
@kaioqrz 2 года назад
Thank you Dave! After so much time trying to understand the useReducer I finally made it! Thank you man!! :D
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@vincejones3381
@vincejones3381 Год назад
Great example and explanation! I haven’t seen the true value of useReducer until this video and I have been learning React for years.
@stokedonthestoke
@stokedonthestoke Год назад
Thanks so much! Used this before I attempted to use useReducer in my app and then felt way more confident about what I was going to do. Your vidoes are great, really appreciate it. When I have questions about something I try to find a video from you first!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Great to hear!
@felixlutrovnik345
@felixlutrovnik345 8 месяцев назад
must admit, i saw at least 5 videos to understand useReducer hook. the only one that was fully understandable for me was your video ! thank you, and keep your great job at explaining fully professional topics for young devs.
@ahmad-murery
@ahmad-murery 2 года назад
This is much more comfortable to work with than using multiple useState hooks as I can manage all my states in one place, I thought for a while that we can pass any property when calling dispatch function then in the reducer we can check whatever properties we passed, I wasn't sure but after doing some research I found that we should use the type property and optionally the payload property when dispatching an action which makes things more organized, sometimes my silliness helps me understand things better, Thanks Dave,
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Spot on Ahmad 💯 Thanks for the note!
@Andi-rd8yf
@Andi-rd8yf Год назад
Exactly what i was looking for, really appreciate your work buddy!
@FitzroydeSilva
@FitzroydeSilva 2 месяца назад
Very clear, I was struggling to understand the concept of useReducer.
@4t196
@4t196 2 года назад
This was easy easy to understand. The best useReducer tutorial so far.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad I could help! 💯
@amancandream
@amancandream Год назад
Went through a couple videos about useReducer and was about to give up and go back to Vanilla js lol. But you explained things super well!! Thanks so much! Subbed!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad I could help!
@javadrip
@javadrip Год назад
Watched many useReducer tutorials and this is the best! Simple, easy to follow and no digressing halfway.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@MuhammadBilal-ry5rb
@MuhammadBilal-ry5rb 10 месяцев назад
Thank you so much SIr Dave I believe you are one of the best Programming instructor in the world right now all programming stuff available in your channel for beginners, intermediate and even for experts as well Thank you so much for your efforts and contribution I'm following you from last 1,2 months for ReactJS you are just amazing teacher I found on this platform Huge Love from Pakistan
@codingispower1816
@codingispower1816 9 месяцев назад
So true.
@dmitriipe4kin838
@dmitriipe4kin838 2 года назад
Man thanks for this video it amazing video, I am from Moldova near Ukraine and my mind full of war between Ukraine and Russian, and I drank 1.5l of beer but when I started wach this video my mind forgot all problems and think about - it amazing and how simple to use it
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad I could help, Tigra! 💯🙏
@ilivetruth
@ilivetruth 7 месяцев назад
Thank you for the video and explanation, much easier to understand than the docs!
@danielconde2729
@danielconde2729 Год назад
Excellent explanation! I was so confused using reducer
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@TrueSQN
@TrueSQN Год назад
I'm from Poland, and for explaining word "dispatch" you have my subscription :D love ya lessons
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@confusedGuenni
@confusedGuenni 9 месяцев назад
I finally got it. Well done tutorial, thank you.
@TheLastPhoen1x
@TheLastPhoen1x 2 месяца назад
Oh my god, thank you, I was starting to think I am dumb. But after watching just half of this video I understood the point of a reducer. Not just "how to use a reducer" but WHY use a reducer.
@ahmedk4345
@ahmedk4345 10 месяцев назад
best explanation i came across, thanx Dave...keep it up!
@ihateorangecat
@ihateorangecat 2 года назад
this is the video that i learnt useReducer hook and i equipped the knowledge to making a todo app all by useReducer without using useState. thanks!🙌
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Great to hear! 💯
@toppmoviehighlights
@toppmoviehighlights 2 года назад
Actually tried the useReducer hook for the first time yesterday..... This has provided a valuable insight to what useReducer really is. Good job.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 🙏💯
@neo90sr
@neo90sr 2 года назад
Very nice explanation. I had some trouble understanding this, but now it's all clear
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Great to hear! 💯🚀
@hamzapaskingakhtar
@hamzapaskingakhtar 10 месяцев назад
Coming here from NetNinja MERN course. I was stuck on the Context part where useReducer was used. This was really a great video. Great teaching, really matches with my way of learning (spoon feeding) :P. Overall, thank you professor.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 10 месяцев назад
Glad it was helpful!
@johnforeverrules
@johnforeverrules 7 месяцев назад
i don't know whether you will see this comment or not. i just wanted to thank you for making such a high quality, easy to understand tutorial. God bless you sensei.
@syeds8314
@syeds8314 Год назад
Many Thanks for the video!❤ After watching and studying several resources, your video made things clear to me.
@iidiez872
@iidiez872 Год назад
Best tutorial for useReducer , you made it really easy to understand.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@flowerofash4439
@flowerofash4439 Год назад
i lilke the way you explain this, you speak "human" thats rare to have as a programmer and very important for a teacher! subscribed!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@focusroom_
@focusroom_ Год назад
This is THE BEST tutorial for useReducer, tysm!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're very welcome!
@abdulazizmashrabov6399
@abdulazizmashrabov6399 2 года назад
Thanks. You are hero. Awesome way of teaching. Hope you make more advanced blogs for react
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 🙏
@xungngo
@xungngo Год назад
Thanks man, your explanation is superb! Keep up the good work.
@mtsurov
@mtsurov Год назад
Best explanation so far. Appreciate you making this tutorial.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@broomybroomybroomy
@broomybroomybroomy 2 года назад
Man, thanks so much for explaining how to update multiple object properties in the same statement. I was pulling my hair out trying to figure out how to do what you did with the spread operator. I was changing one thing with useState and it was wiping out everything else in the object
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it helped! 💯
@suri5023
@suri5023 2 года назад
very clear explanation and easy to understand thank you sir
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Suri!
@dranix5018
@dranix5018 Год назад
Very clear and well explained! Thanks.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@mattstopa9436
@mattstopa9436 6 месяцев назад
Thanks for giving a practical example
@DaveGrayTeachesCode
@DaveGrayTeachesCode 6 месяцев назад
Glad it was helpful!
@Jawad_Siddiqui
@Jawad_Siddiqui 2 года назад
God gifted teacher😀Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you for the kind words, Mohammed! 🙏🙏
@hannah51238
@hannah51238 Год назад
This is such a great explanation of useReducer! Thanks very much Dave 😍
@adi4057
@adi4057 Год назад
The best video to understand this concept. Thank man!!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome!
@joseff5998
@joseff5998 2 года назад
Thank you so much Dave! I was really trying to understand the use Reducer. This was so clear!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad I could help, Josef!
@umairqamar2672
@umairqamar2672 2 года назад
this is super duper amazing. Thank you Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Umair!
@Un0Real333
@Un0Real333 2 года назад
Just brilliant! I did so much refactoring and made my code look better and more reusable, after watching your videos, keep up the good work!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
I'm glad I could help!
@user-ol6tq5hw7s
@user-ol6tq5hw7s 2 года назад
I watched a lot of clips about useReducer and after this it is crystal clear to me so you are great and just keep it up because these are amazing videos and thank you very much for that! Big Greetings from Serbia Dave. :)
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Great to hear from Serbia! And glad I could help 💯🙏
@BabaNoami
@BabaNoami 2 года назад
Thanks. Very clear explanation. My first real intro to useReducer. Looking forward to putting it into practice.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Noam 🙏💯
@barreg17
@barreg17 Год назад
I finally understood it. Massive thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it helped!
@AndreeaCozariuc
@AndreeaCozariuc 2 года назад
Dave, you are a blessing. Thank you ❤‍🔥
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome!
@SimPwear84
@SimPwear84 2 года назад
Nicely explained! Short, sweet and straight to the point. Thank you
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 💯
@fabricio-garcia
@fabricio-garcia Год назад
What a great way to teach concepts! Subscribed to the channel already.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Welcome aboard!
@RS-iy2bm
@RS-iy2bm Год назад
The best tutorial i watched that made it all easy.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad to hear that!
@randomtalks5253
@randomtalks5253 Год назад
You are simply Love!! Such a great video. Helped me alot. Clear toThePoint conCise and compreHensive❤
@muhammedozalp
@muhammedozalp Год назад
Thank you bro. This is a very good tutorial.
@AvinashSingh-ts1cn
@AvinashSingh-ts1cn 2 года назад
Thanks a ton for sharing your knowledge. I am now a subscriber to your channel and found some other best videos. Thanks a lot man
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@JedOpeningThings
@JedOpeningThings 2 года назад
Thank you! This is prolly the cleanest and best video for the useReducer hook I can find!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful! 💯🙏
@clevercoderjoy
@clevercoderjoy Год назад
wow this has been so helpful I was able to implement this in my project
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad to hear that!
@OnlyPlayStation5
@OnlyPlayStation5 Год назад
The best video I watched for usereducer, can you please do all react hooks
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you! My React Hooks playlist has most: ru-vid.com/group/PL0Zuz27SZ-6PSdiQpSxO9zxvB0ns6m3ta
@jamshidtashkent1976
@jamshidtashkent1976 Год назад
Thank you Dave. It is really cool
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome!
@harisharris5902
@harisharris5902 Год назад
Watched this topic on Udemy course, got so confused there 😖, but your explanation is superb! You have lovely tone to your voice I could listen you for hours!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it helped and thank you for the kind words! 🙏
@pfcokelly
@pfcokelly Год назад
Subbed, great tutorial!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Welcome!
@masruralam6199
@masruralam6199 2 года назад
How clear explanation, I ever found. Thanks Dave Gray..
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@kamaboko1
@kamaboko1 2 года назад
Great video. Subscribed!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 💯
@shayanfaghihi
@shayanfaghihi 2 года назад
Wow! You rocked it; Thanks Dave for this super and comprehensive video. I watch the very first second of the video, and I could run the app by myself. The rest was for better understanding 😉
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Shayan!
@anaslaraki
@anaslaraki 2 года назад
the best tutorial on the topic
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 🙏
@ebesquin
@ebesquin Год назад
Thank you so much. As always a great tutorial
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome!
@sadamali6691
@sadamali6691 2 года назад
Waaaw thank you teacher dave greating you from somalia🇸🇴
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Wiz! And hello to Somalia! 👋
@prankurpandeyy
@prankurpandeyy 2 года назад
Been struggling on this topic for a month now i will first make all things in usestate , then covert all that into reducer
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Good plan! It will help you understand the difference 💯
@tomnewton3191
@tomnewton3191 2 года назад
Great video, very clearly explained. Thanks, Tom
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Tom!
@farantariq3481
@farantariq3481 2 года назад
Best explanation I've found of reducers 👍
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Faran! 🙏💯
@wahhaab7
@wahhaab7 2 года назад
Thx a lot, finally understood this
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it helped! 💯
@ashharkausar413
@ashharkausar413 2 года назад
Instructive as always. Wish I had seen this video earlier it would've made my code much more optimal!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful!
@sdfsdfsdffdsfsdfsd123
@sdfsdfsdffdsfsdfsd123 2 года назад
very well explained as always. THANK YOU
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You are welcome! 💯
@Programming162
@Programming162 10 месяцев назад
thank you very much you saved my time
@gogas2860
@gogas2860 2 года назад
Wow, the best explanation of usereducer hook, I've ever watched. Thank you very much!!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@benarcher372
@benarcher372 2 года назад
Excellent. Now I know what to replace Redux with in my small projects.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Right on Ben! 💯
@wdwaleed
@wdwaleed Год назад
How and what would you pass down if you had components in separate files? Do I only have to pass down state and dispatch as props?
@THEJOAMS
@THEJOAMS Год назад
That helps me a lot 🙏
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad to hear it!
@phucwall121
@phucwall121 2 года назад
Thank you so much Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome!
@juhairahamed5342
@juhairahamed5342 2 года назад
Good explanation related useReducer
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Happy to help!
@jeetsingh-sy5ij
@jeetsingh-sy5ij Год назад
Thank you sir, great explanation and examples. Appreciated!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@Pareshbpatel
@Pareshbpatel 2 года назад
The benefits of deploying the useReducer Hook, so beautifully and succinctly described. Thank you, Dave {2022-04-11}, {2022-08-02}
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome, Paresh! 🙏
@aleksandarhristov2918
@aleksandarhristov2918 7 месяцев назад
It's just Redux inside React. I guess Dan Abramov is the one to blame for this feature :) The only downside is that it's the oldest of the Redux patterns with a lot of boilerplate, and most importantly, you need to keep an eye on all other state, so it's not accidentally being overwritten (big downside). In my opinion, this hook must be enhanced soon. Personally, I don't like it that much because of the things I mentioned.
@fatbubble123
@fatbubble123 2 года назад
So the idea is to withdraw perfectly good functional programming and instead opt for additional boilerplate code? Great tutorial. This really helps me to understand use reducer. This is well made and informative.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it helped out!
@harag9
@harag9 11 месяцев назад
Great vid Dave, many thanks for this. Just a couple quick questions, but I'll have a play anyway. 1. I take it when you despatch(xxx) that then does a rerender just like if you do setColor(true) 2. useEffect - if I wanted to fire off some code when the count changes I would use setCount(23) and then add a dependency on the useEffect to maybe fire off an API. Is it the same here, would we just put state.count in the useEffect dependency ?
@ahmedmohned387
@ahmedmohned387 2 года назад
Thank you very much for this wonderful tutorial.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're very welcome! 💯
Далее
useLayoutEffect vs useEffect | React Hooks Tutorial
5:16
Learn React useReducer Hook with Examples
14:19
Просмотров 175 тыс.
NextJS Parallel Routes Explained with a Simple Example
14:04
useReducer Hook - React In Depth
55:25
Просмотров 1,5 тыс.
6 State Mistakes Every Junior React Developer Makes
15:53
Learn useReducer In 20 Minutes
20:12
Просмотров 506 тыс.
React useState() hook introduction 🎣
16:33
Просмотров 28 тыс.
Stop Doing this as a React Developer
12:27
Просмотров 163 тыс.