All 12 useState & useEffect Mistakes Junior React Developers Still Make in 2024

  Рет қаралды 809,775

ByteGrad

ByteGrad

Күн бұрын

Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
👉 Add auth to your app FAST: bit.ly/3QOe1Bh
👉 NEW React & Next.js Course: bytegrad.com/courses/professi...
👉 Professional JavaScript Course: bytegrad.com/courses/professi...
👉 Professional CSS Course: bytegrad.com/courses/professi...
👉 Discord: all my courses have a private Discord where I actively participate
🔔 Email newsletter (BIG update soon): email.bytegrad.com
⏱️ Timestamps:
0:00 Intro
0:06 12/12 - State updates aren't immediate
2:35 11/12 - Conditional rendering
4:46 10/12 - Updating object state
7:59 9/12 - 1 Object state instead of multiple smaller ones
11:25 8/12 - Information can be derived from state / props
14:32 7/12 - Primitives vs non-primitives
19:05 6/12 - Initializing state with object
22:12 5/12 - TypeScript mistakes
27:19 4/12 - Not using custom hooks
30:59 3/12 - Server & Client components
33:08 2/12 - Stale closure
38:42 1/12 - Fetching in useEffect
#webdevelopment #programming #coding

Пікірлер: 735
@Bukosaure
@Bukosaure 9 ай бұрын
I am now quite experimented with React and already knew everything you covered in the video. But I still want to say that this video is pure bomb. The amount of useful information contained in it is quite impressive and really straight to the point. I would have love to have seen it about a year ago. :)
@ByteGrad
@ByteGrad 9 ай бұрын
Haha thanks, appreciate it
@Endrit719
@Endrit719 8 ай бұрын
same here, I just came to see the content but it's really helpful for the beginners, at some point I was making all these mistakes
@SSG_GAMING_000
@SSG_GAMING_000 7 ай бұрын
@@Endrit719 Us bro us.
@aleksandrS3894
@aleksandrS3894 5 ай бұрын
For me, as a backend developer it’s a pure gem. Everything I should keep in mind in a one video. So easy to refresh knowledge when I had to make some UI parts.
@seventyMinus1
@seventyMinus1 8 ай бұрын
I am a self-taught frontend developer. I know many teachers who teach online, but trust me, the way you explain things is so easy to understand. To me, you are the best teacher. I can't thank you enough. If I had money, I would have definitely bought your courses. Anyways Thank you so much for giving us your valuable time, and I love you.
@nonefvnfvnjnjnjevjenjvonej3384
@nonefvnfvnjnjnjevjenjvonej3384 26 күн бұрын
react is a steaming pile of hot garbage.. lol..
@seventyMinus1
@seventyMinus1 26 күн бұрын
@@nonefvnfvnjnjnjevjenjvonej3384 no cap
@bushbuddyplatypus
@bushbuddyplatypus 4 ай бұрын
I am a grumpy and impatient senior dev who was soothed by your calm voice and clear explanations. Also learnt a few things. Thanks.
@adamd0ggg2
@adamd0ggg2 9 ай бұрын
I definitely prefer multiple returns. Most components end up with distinct states that make breaking it down into more declarative components easier to follow. This a personal choice I adopted from React Query tutorials. if(loading){ return } if(error){ return } return If you add a key to PostBody then React will identify each of those components as unique. That will eliminate the race condition and reduce the dependencies in the useEffect Array. Loved your explanation of the setInterval. I never quite understood the problem there.
@joseluisperez5137
@joseluisperez5137 8 ай бұрын
I do multiple returns as well because if not, one return can become into a return hell, hard to read and follow
@pete531
@pete531 8 ай бұрын
cant we just say: {loading ? : error ? : }
@shivambisht9009
@shivambisht9009 8 ай бұрын
@@pete531 Yes, but that's not very readable and scalable.
@ImKeviin9
@ImKeviin9 8 ай бұрын
I prefer that way too
@user-sw1wq8lh2w
@user-sw1wq8lh2w 8 ай бұрын
​@@pete531 most teams I've been on ban nested ternaries to avoid complication in logic that is already highly complex.
@theshahbazahmad
@theshahbazahmad 9 ай бұрын
Brother you solved many of my doubts. You have no idea how helpful and important these kind of videos are for me. Keep making such videos. Full support mate!
@ByteGrad
@ByteGrad 9 ай бұрын
Glad to hear that
@darklord9500
@darklord9500 9 ай бұрын
@@ByteGrad Thank You Brother 🙏
@oru8185
@oru8185 6 ай бұрын
The first case actually helped me a lot! At my job I was fixing a bug and couldn't figure out why component state was behaving wierdly, tourns out it was the multiple setState (although not direct) calls in one useEffect that were the problem
@crizwiz489
@crizwiz489 9 ай бұрын
I really love how direct and precise it is with handle certain react problems. Please do more of this format of videos.I learnt a lot and I appreciate you man. Keep it up
@rushboy1971
@rushboy1971 6 ай бұрын
Absolutely fantastic video. As a kinda newbie to NextJS and REACT, I was happy that I'd figured out most of these on my own, but some of them (the object item name in brackets trick) will really help get my code leaner.
@alessandrospiridigliozzi7943
@alessandrospiridigliozzi7943 7 ай бұрын
One of the best videos on React!!!! I've been working as a dev with react for over 1 year now and there were a lot of things in this video that I did not know! Most online courses never fully explain what happens underneath the hood, so thank you!!!
@user-ov5wg9qd8h
@user-ov5wg9qd8h 4 ай бұрын
이야 강의가 너무 기가 막혀요🥰👍 궁금했던 부분을 시원하게 긁어주는 기분이네요 감사합니당
@elidonmorina
@elidonmorina 8 ай бұрын
Great one! Straight to the point, typical and practical life examples! Keep it up and the volume a bit up for the future videos haha
@AveN7ers
@AveN7ers 9 ай бұрын
Man after learning Solid and Svelte, I'm starting to find React to be so convoluted.
@DEVDerr
@DEVDerr 9 ай бұрын
Because it always was. Even with better alternatives (Solid and Svelte as you've mentioned... and more), to this day so many React devs are living with a React copium
@gamevidzist
@gamevidzist 9 ай бұрын
It is
@Angeal98
@Angeal98 9 ай бұрын
​@@DEVDerrit's not copium, I just want an existing ecosystem of packages. Component libraries, styling solutions, utility components, specific solutions libraries etc. They all exist for react and not svelte nor Solid
@ColossalMcBuzz
@ColossalMcBuzz 9 ай бұрын
@@DEVDerr They aren't living with copium, they're living with jobs.
@Salantor
@Salantor 9 ай бұрын
@@Angeal98 You can always search for general, not tied to frameworks solutions. Those exist and there is quite a lot of them.
@tomkatdev
@tomkatdev 9 ай бұрын
A really great run through of correct patterns and component lifecycles mate, As someone who is 2 years into react, and 9 months or so into ts, I found this a really nice way to confirm my existing understanding, and clear up a few points I had only somewhat understood. Thanks for this :)
@raves_r3177
@raves_r3177 Ай бұрын
I am a self-learning newbie in React and you sir just made learning React a lot easier! Simple, straight to the point, no unnecessary stuff. The time I saved by watching this video instead of scouring the docs is priceless. Thank you very much.
@personal3314
@personal3314 8 ай бұрын
You somehow have managed to address every one of my concerns or gaps I believed I had in my knowledge across all your videos on react and Javascript. Thank you 🙏
@lukas.webdev
@lukas.webdev 8 ай бұрын
That's awesome!
@aadispare3673
@aadispare3673 6 ай бұрын
The best thing happened to me in recent times is your video popping up on my youtube homepage suggestions. So much clarity and valuable information. Subscribed and will surely recommend your channel to every React dev in my circle
@memaimu
@memaimu 5 ай бұрын
I think I need new speakers.
@MushrathChoudhury
@MushrathChoudhury 7 күн бұрын
Lol no. I think his mic settings must be horribly wrong. It looks like he has a quite expensive microphone, and yet it sounds like a gaming headset
@ProgramWithErik
@ProgramWithErik 9 ай бұрын
This is crazy how much you've blown up in the last month! I saw you've created nearly 400 videos in one year, getting 50-100 views per video until recently! It's really inspiring how you never gave up!
@ByteGrad
@ByteGrad 9 ай бұрын
Haha true. Switched up the style a bit!
@Grozny446
@Grozny446 5 ай бұрын
thanks a lot, useful video. i'm not a begginer but often i don't think about to do some more cleaner if it works. you have fixed my mind
@Larriisama
@Larriisama 2 ай бұрын
This was really helpful, I recognize a few mistakes I've done and though I've worked around the errors, your explanations gave me a better understanding to why I saw errors or such. Really cool vid and most of all thanks for sharing. I've just recently gotten serious about next.js but before that I used to fetch data in a useEffect much like you said
@goodtimeswerehad
@goodtimeswerehad 4 ай бұрын
Fantastic video! First one of yours I've come across (thanks KZfaq). I'm now a subscriber
@bennzeppelin
@bennzeppelin 6 ай бұрын
Nice touch flipping the video as you move from editor to console 😄 Very helpful vids thx
@positronalpha
@positronalpha 6 ай бұрын
I've been developing JS for 25 years, so I'm not really making the mistakes you list, but I'm only two weeks into React and this was a great crash course on its basic mechanisms. Between the lines, you managed to make it much more clear than the horrible hand-wavy official documentation which reads like it was written by people who don't know the basics of the language.
@IgorYatskiv
@IgorYatskiv 5 ай бұрын
Do you like hooks overall? I'm around 15 years into JS development. But I hate functional programming with all that half/solutions. Why would anyone prefer functions over better structured, more clean classes (long awaited) syntax and OOP approach in general? 🤷‍♂
@rayaqin
@rayaqin 5 ай бұрын
@@IgorYatskiv I started React development when hooks were not yet available, and I like this new functional approach much more. I very rarely have to resort to creating any classes in very special cases.
@positronalpha
@positronalpha 4 ай бұрын
The way I see it, classes in JavaScript and TypeScript are a less-than-useful hack that don't work in any way like I'd expect. For me, the simplicity of prototypal inheritance, functions and closures are the beautiful bits of the language. That said, I think the state of the JS/TS ecosystem is really sad and avoid it whenever possible, even though I love writing JavaScript.
@Namespace_Manny
@Namespace_Manny 9 ай бұрын
I just got through a week of useState and useEffect, and this video helped answer a lot of questions. Keep it up man!
@siddharthjoshi3328
@siddharthjoshi3328 8 ай бұрын
Saw this video, loved your straight to the point style and even bought your JS course for the projects it covers. Thanks
@ecodersofficial
@ecodersofficial 25 күн бұрын
I already knew that we can use one big useState but I had likely forgot it and still used multiples. Thanks for telling these!
@Lalit-yw2tb
@Lalit-yw2tb 8 ай бұрын
I learnt all these things by trial and error while using react in my project. This is such a brilliant video that is going to help any new developer starting with react/nextjs to avoid the pitfalls. This video is jampacked with information. Such an amazing channel.
@aviaduvdevan
@aviaduvdevan 5 ай бұрын
Great video! You really take the time to explain everything and you do it very well
@timkoprivnik9875
@timkoprivnik9875 5 ай бұрын
really, really good explanation of everything! thanks a lot for that video. would love to see more.
@dandheedge
@dandheedge 7 ай бұрын
It's always so good to get a basic understanding like this!
@RoyiaiHackersChristo
@RoyiaiHackersChristo 8 ай бұрын
Amazing. I made all of these mistakes when I started with React some years ago. Hope every React beginner's can watch this.
@hskdjs
@hskdjs Ай бұрын
38:34 If you leave it as is, your "setInterval" would never be canceled until you close or reload the page. If you call setInterval or setTimeout inside useEffect, always destroy that interval / timeout.
@asztonselecta965
@asztonselecta965 6 ай бұрын
Thank you so much. I love the way you teaching. I working as a junior react developer for 2 years already, but still this video helps me a lot. Great job
@ruxinqu871
@ruxinqu871 21 күн бұрын
learned so much! thank you for the video!
@BrunoSilva-vw4uo
@BrunoSilva-vw4uo 7 ай бұрын
The video is totally necessary! Good job dude!
@luciopereirabrito3154
@luciopereirabrito3154 7 ай бұрын
That's amazing thank you a lot for this video!
@ansonwoohk1984
@ansonwoohk1984 8 ай бұрын
Thanks! Great for me as a new React Developer from Angular
@codefrite
@codefrite 9 ай бұрын
Incredibly dense content full of nice tricks, best practices and clear concepts explanations. It felt like learning "the right way" of coding things in modern JS. This is the first video I watch from you and it made me buy your Udemy JS course. I'll be spending the day watching it. Looking forward for a TS course :) Cheers from Belgium !
@romaneaugustin2462
@romaneaugustin2462 5 ай бұрын
Thx for the comment. I should look for his course online. I always study javascript with Stephen Grider; thought he was the top dog.
@KeshavAneja
@KeshavAneja 3 ай бұрын
Thank you so much for this amazing video!
@ShanaSkydancer
@ShanaSkydancer 3 ай бұрын
Great video! I love the way you teach! Thank you for all the effort you put into this! 🙂
@rubenramirezdev
@rubenramirezdev 7 ай бұрын
Thank you for this video. #9 really helped me out!
@user-zo5wp3su8y
@user-zo5wp3su8y Ай бұрын
Great Explanation. Thanks!!!
@lucasa8710
@lucasa8710 8 ай бұрын
quick counter point on the 8:01 topic, using a single object to store the state of all the inputs will produce a lot of objects, the garbage collector will run more times and the component will update all the inputs that depend on the `useState` which can, some times, reduce performance significantly. By using separate states your component will update way less and create less objects and use less garbage collection cicles
@mikeh8498
@mikeh8498 8 ай бұрын
Great video. These quick reminders are very helpful! Especially because you often see multiple ways of doing the same thing but no one explains why it works.
@jameskayihura1675
@jameskayihura1675 5 ай бұрын
Thanks you very much, I ran through this situation
@TheCodeHunter
@TheCodeHunter 2 ай бұрын
as a junior dev, this video certainly helped me solve a lot of issues I had with my code, thank you!
@indrajitadhikary6989
@indrajitadhikary6989 6 ай бұрын
With this video I lerned more in an hour than what I learned in one and a half day searching. Thanks!
@itsmepawan
@itsmepawan 5 ай бұрын
Loved the video. Subbed 🙌
@deebo5284
@deebo5284 7 ай бұрын
Been a while since I touched React, and when I did try it out, I just did a few small projects. It was a good intro, but I feel like I retained little. But watching this was so much fun. I'm excited to try it again soon!
@basmong
@basmong 8 ай бұрын
I like that all the details are also discussed. Great video.
@bikukist5
@bikukist5 3 ай бұрын
Thank you for the insights. You clarified my doubts with this video with mistakes that I overlook those features sometimes even I work on them. Thank you for helping out to everyone sharing your knowledge in react and other tech stack.
@tghhh19
@tghhh19 5 ай бұрын
Great video, thank you for creating this.
@maherylala2153
@maherylala2153 5 ай бұрын
21:55 You could also check if the post is null or not and use that to show if it's loading or not. Helpful video btw 👍
@albertgouws13
@albertgouws13 7 ай бұрын
Great video especially the pace at what you presented. It was 👌No time wasting and just kept going.
@Iza90bela
@Iza90bela 8 ай бұрын
and just when i say i grasped react here bytegrad comes to drop new knowledge , thank you sir again i learned css and js from you ! now i cant wait for your nextjs course i was planning to learn it in the future. you really changing my life :,)
@asuosnotielc
@asuosnotielc 8 ай бұрын
Great tips! Thanks a lot!
@maorazoulay
@maorazoulay 8 ай бұрын
This is fantastic! Thanks a lot
@Adventures_English
@Adventures_English 6 ай бұрын
I watched all the other KZfaqrs and their covering of these similar topics. You by far do it the best!
@john_dren
@john_dren 8 ай бұрын
I finally understood the relevance of the spread ... operator with your real world example. Thanks to you
@snakesoul
@snakesoul 8 ай бұрын
As a learning developer, I run across hundreds of baity videos, but this one was really useful
@wilhelmburger9588
@wilhelmburger9588 6 күн бұрын
This is an amazing video, thank you dude.
@adnanniaz77
@adnanniaz77 8 ай бұрын
Amazing content and the way of explanation (smooth and calm). Keep it up, would love to see more on React/TypeScript and probably Jest in the future :)
@dsyph3r
@dsyph3r 2 ай бұрын
Excellent video. For the stale enclosure section, you should still have the clean up function for the setTimeout even if you are using the setCount((current) => count +1) method. The interval needs to be cleaned up when the component is unmounted.
@nstha8848
@nstha8848 Ай бұрын
17:00 best explanation
@victorsaisse1340
@victorsaisse1340 9 ай бұрын
I new all of them except for the last one, amazing!
@rin0422
@rin0422 Ай бұрын
Thank you so much. I learned a lot
@jennisonb37
@jennisonb37 8 ай бұрын
I have just started learning react and this video was extremely helpful. It's super clear and understandable. Thank you.
@levantos
@levantos 9 ай бұрын
Amazing video, watching it from start to finish. Loved it. A React Context and prop drilling best practices would be be amazing as well
@krvns
@krvns 6 ай бұрын
This is 46 minutes of pure gold! Thank you!
@tigranharutyunyan7674
@tigranharutyunyan7674 5 ай бұрын
Fluidity and conciseness. Thanks!
@martynaguja4493
@martynaguja4493 5 ай бұрын
Super useful, thank you!
@saputrauta09
@saputrauta09 6 ай бұрын
you are a great teacher!, thanks!
@TheMaxZakh
@TheMaxZakh 8 ай бұрын
this was great, thanks!
@my_privat_account
@my_privat_account 3 ай бұрын
Excellent examples and explanations, thanks a lot!
@omaribbrahim
@omaribbrahim 8 ай бұрын
This video is amazing! Kudos. It warms my heart that I am still an intern and all of this is basically muscle memory at this point.
@anthonyezeh7511
@anthonyezeh7511 7 ай бұрын
You simplified a lot for me♥️
@eliaspaulinho8435
@eliaspaulinho8435 9 ай бұрын
this explains a lot !!!!! i now understand!!!! thank you🙏
@phucnguyen0110
@phucnguyen0110 9 ай бұрын
I gotta thank the algorithm for recommending me this video, Wesley! You solved so many things that I was curious in the past! And with Udemy having a big sales event atm I might just grab both of your CSS + JS courses!
@Digitalknifeparty
@Digitalknifeparty 8 ай бұрын
Likewise. Video has been helpful. I have several years of experience with JS, CSS, HTML, etc, but only been using React for 6 months or so. Just learned about using Vite over CRA the other day 😅 Hopefully I can land a React job soon!
@eddiegere
@eddiegere 4 ай бұрын
Amazing video with valuable information. Thank you.
@rauffares3558
@rauffares3558 25 күн бұрын
Great Video and very concise👏
@UzairSalim-dy3uz
@UzairSalim-dy3uz 8 ай бұрын
Would love to see more videos like these subscribed!!
@ToffeeFrance
@ToffeeFrance 6 ай бұрын
Great video, thanx !!
@luizeduardo8545
@luizeduardo8545 Ай бұрын
Nice video, I'm on my first big React project and your video helps me a lot, thank you very much!
@maurov2104
@maurov2104 9 ай бұрын
This video shows how counterintuitive React is!
@SouhaibD
@SouhaibD 2 ай бұрын
Thanks for the tips that was very smooth
@mikro_rimoslav
@mikro_rimoslav 3 ай бұрын
11/12 - If you still need to call hooks only if a certain condition is met (like on 03:24), which is often the case in practice, you can: 1) return "No id provided" if there's no id 2) copy and paste the code between the lines 6 and 11 into a separate component in which you call those hooks indiscriminately. 3) return that component instead of lines 6-11.
@dawid-bobowski
@dawid-bobowski 2 ай бұрын
Thank you for the video. Very useful stuff to keep in mind!
@whatskookin6429
@whatskookin6429 3 ай бұрын
You explain it so good brother, thank you!
@razintailor
@razintailor 8 ай бұрын
this content is really helpful. the nuances discussed are both detailed yet put in simple language. thanks alot
@RalfSchlindwein0
@RalfSchlindwein0 8 ай бұрын
As a rookie reactjs developer i skipped many fundamentals and jumped straight to the code. Now i see how such concepts was important. thx for your time doing such a helpful video.
@mohammedsaber6782
@mohammedsaber6782 7 ай бұрын
Great man, Keep going. It's helpfull.
@KingstonFortune
@KingstonFortune 6 ай бұрын
wow so many useful tips packed in this, thanks for the vid!
@harukazeeh
@harukazeeh 7 ай бұрын
glad I watched this video because I learned more things and I can use the form object state for the first React project I'm currently doing 😊
@count_of_pizza
@count_of_pizza 8 ай бұрын
Not only Junior React developers but also mids, so called seniors and all kind of full-stacks who have no idea about JS. Fantastic video :)
@belalmahmoud1890
@belalmahmoud1890 5 ай бұрын
Very good video, thank you!
@zincnims9514
@zincnims9514 7 ай бұрын
This is god send, you gave me the exact solutions i need now
@shafiemukhre
@shafiemukhre 7 ай бұрын
really good, thank you for creating this! More contents for professional react developer
@osamaxz5720
@osamaxz5720 3 ай бұрын
thanks so much for sharing this info for free because I never saw a free course giving like this useful info. You are from the rare people man ❤
@hsujongee7963
@hsujongee7963 6 ай бұрын
Awesome Tutorial!
@bilmoleque2
@bilmoleque2 8 ай бұрын
The fact that I could guess every solution as soon as you started presenting the problem really makes me happy of my evolution as a react developer.
@lukas.webdev
@lukas.webdev 8 ай бұрын
Congrats buddy! 😉
@aimifirdhausshafie9976
@aimifirdhausshafie9976 8 ай бұрын
me too, I can't believe my self either..
TypeScript in React - COMPLETE Tutorial (Crash Course)
53:21
ByteGrad
Рет қаралды 186 М.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Рет қаралды 41 М.
FOOTBALL WITH PLAY BUTTONS ▶️ #roadto100m
00:29
Celine Dept
Рет қаралды 53 МЛН
YouTube's Biggest Mistake..
00:34
Stokes Twins
Рет қаралды 76 МЛН
Turning bad React code into senior React code
13:10
Cosden Solutions
Рет қаралды 83 М.
Web Developer Roadmap (2024) - Everything is Changing
25:02
ByteGrad
Рет қаралды 245 М.
Common Mistakes and Advanced Typescript Techniques
10:49
Ljupche Vasilev
Рет қаралды 6 М.
Top 6 React Hook Mistakes Beginners Make
21:18
Web Dev Simplified
Рет қаралды 556 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 334 М.
Goodbye, useEffect - David Khourshid
29:59
BeJS
Рет қаралды 492 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 446 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 140 М.
6 State Mistakes Every Junior React Developer Makes
15:53
Lama Dev
Рет қаралды 262 М.
FOOTBALL WITH PLAY BUTTONS ▶️ #roadto100m
00:29
Celine Dept
Рет қаралды 53 МЛН