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

  Переглядів 785,921

ByteGrad

ByteGrad

День тому

Hi, I'm Wesley. I'm a brand ambassador for Kinde. I'll help you master the latest tech here:
👉 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

КОМЕНТАРІ: 718
@bushbuddyplatypus
@bushbuddyplatypus 3 місяці тому
I am a grumpy and impatient senior dev who was soothed by your calm voice and clear explanations. Also learnt a few things. Thanks.
@mhsanto6495
@mhsanto6495 7 місяців тому
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 9 днів тому
react is a steaming pile of hot garbage.. lol..
@mhsanto6495
@mhsanto6495 9 днів тому
@@nonefvnfvnjnjnjevjenjvonej3384 no cap
@Bukosaure
@Bukosaure 8 місяців тому
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 8 місяців тому
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 4 місяці тому
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.
@oru8185
@oru8185 5 місяців тому
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
@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 6 місяців тому
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!!!
@AveN7ers
@AveN7ers 8 місяців тому
Man after learning Solid and Svelte, I'm starting to find React to be so convoluted.
@DEVDerr
@DEVDerr 8 місяців тому
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 8 місяців тому
It is
@Angeal98
@Angeal98 8 місяців тому
​@@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 8 місяців тому
@@DEVDerr They aren't living with copium, they're living with jobs.
@Salantor
@Salantor 8 місяців тому
@@Angeal98 You can always search for general, not tied to frameworks solutions. Those exist and there is quite a lot of them.
@crizwiz489
@crizwiz489 8 місяців тому
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
@tomkatdev
@tomkatdev 8 місяців тому
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 :)
@theshahbazahmad
@theshahbazahmad 8 місяців тому
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 8 місяців тому
Glad to hear that
@darklord9500
@darklord9500 8 місяців тому
@@ByteGrad Thank You Brother 🙏
@raves_r3177
@raves_r3177 27 днів тому
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.
@aadispare3673
@aadispare3673 5 місяців тому
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
@adamd0ggg2
@adamd0ggg2 8 місяців тому
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 7 місяців тому
cant we just say: {loading ? : error ? : }
@shivambisht9009
@shivambisht9009 7 місяців тому
@@pete531 Yes, but that's not very readable and scalable.
@ImKeviin9
@ImKeviin9 7 місяців тому
I prefer that way too
@user-sw1wq8lh2w
@user-sw1wq8lh2w 7 місяців тому
​@@pete531 most teams I've been on ban nested ternaries to avoid complication in logic that is already highly complex.
@Namespace_Manny
@Namespace_Manny 8 місяців тому
I just got through a week of useState and useEffect, and this video helped answer a lot of questions. Keep it up man!
@ProgramWithErik
@ProgramWithErik 8 місяців тому
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 8 місяців тому
Haha true. Switched up the style a bit!
@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!
@Lalit-yw2tb
@Lalit-yw2tb 7 місяців тому
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.
@Grozny446
@Grozny446 4 місяці тому
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
@elidonmorina
@elidonmorina 7 місяців тому
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
@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
@user-ov5wg9qd8h
@user-ov5wg9qd8h 4 місяці тому
이야 강의가 너무 기가 막혀요🥰👍 궁금했던 부분을 시원하게 긁어주는 기분이네요 감사합니당
@asztonselecta965
@asztonselecta965 5 місяців тому
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
@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.
@TheCodeHunter
@TheCodeHunter 2 місяці тому
as a junior dev, this video certainly helped me solve a lot of issues I had with my code, thank you!
@bennzeppelin
@bennzeppelin 5 місяців тому
Nice touch flipping the video as you move from editor to console 😄 Very helpful vids thx
@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.
@positronalpha
@positronalpha 5 місяців тому
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 4 місяці тому
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 4 місяці тому
@@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.
@codefrite
@codefrite 8 місяців тому
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.
@levantos
@levantos 8 місяців тому
Amazing video, watching it from start to finish. Loved it. A React Context and prop drilling best practices would be be amazing as well
@deebo5284
@deebo5284 6 місяців тому
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!
@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
@puopg
@puopg 8 місяців тому
For the last one, tbh I would just use a debounce with no leading trigger. Since then no network call goes out and only fires once you’ve “settled” This way you never hammer ur server until the user has essentially stopped
@tek9ine130
@tek9ine130 8 місяців тому
Can you elaborate a bit on how you would achieve that in Nextjs?
@puopg
@puopg 8 місяців тому
Errr, this isn’t a framework thing, just javascript. Say you just use lodash.debounce, it would basically just be Const myDebouncedFn = _.debounce(myFn, 250, { leading: false }); And then just swap the method out in this case for the video
@codemonkeybusiness
@codemonkeybusiness 8 місяців тому
My thoughts exactly. Either that or disable the button while the HTTP call is running
@timkoprivnik9875
@timkoprivnik9875 5 місяців тому
really, really good explanation of everything! thanks a lot for that video. would love to see more.
@ruxinqu871
@ruxinqu871 4 дні тому
learned so much! thank you for the video!
@bikukist5
@bikukist5 2 місяці тому
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.
@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 :)
@indrajitadhikary6989
@indrajitadhikary6989 6 місяців тому
With this video I lerned more in an hour than what I learned in one and a half day searching. Thanks!
@dandheedge
@dandheedge 7 місяців тому
It's always so good to get a basic understanding like this!
@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 :)
@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.
@goodtimeswerehad
@goodtimeswerehad 4 місяці тому
Fantastic video! First one of yours I've come across (thanks UKposts). I'm now a subscriber
@Adventures_English
@Adventures_English 6 місяців тому
I watched all the other UKpostsrs and their covering of these similar topics. You by far do it the best!
@ShanaSkydancer
@ShanaSkydancer 3 місяці тому
Great video! I love the way you teach! Thank you for all the effort you put into this! 🙂
@luizeduardo8545
@luizeduardo8545 24 дні тому
Nice video, I'm on my first big React project and your video helps me a lot, thank you very much!
@Iza90bela
@Iza90bela 7 місяців тому
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 :,)
@ecodersofficial
@ecodersofficial 9 днів тому
I already knew that we can use one big useState but I had likely forgot it and still used multiples. Thanks for telling these!
@hskdjs
@hskdjs 21 день тому
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.
@jennisonb37
@jennisonb37 7 місяців тому
I have just started learning react and this video was extremely helpful. It's super clear and understandable. Thank you.
@ansonwoohk1984
@ansonwoohk1984 7 місяців тому
Thanks! Great for me as a new React Developer from Angular
@osamaxz5720
@osamaxz5720 2 місяці тому
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 ❤
@NekoMimiMeowr
@NekoMimiMeowr 6 місяців тому
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 😊
@aviaduvdevan
@aviaduvdevan 4 місяці тому
Great video! You really take the time to explain everything and you do it very well
@phucnguyen0110
@phucnguyen0110 8 місяців тому
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!
@gabrieldonnantuonilima3719
@gabrieldonnantuonilima3719 7 місяців тому
Nice video! But I'd like to correct the 3/12 mistake. It's not the component that imports that can be turned into a client component, if so all the tree would be turned into it if you had a client component on the leaf of the tree. Actually, the one being imported that can change. So if you have a client component and import a server component into it... that server component will be turned into a client component.
@rubenramirezdev
@rubenramirezdev 7 місяців тому
Thank you for this video. #9 really helped me out!
@mikro_rimoslav
@mikro_rimoslav 2 місяці тому
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.
@luciopereirabrito3154
@luciopereirabrito3154 7 місяців тому
That's amazing thank you a lot for this video!
@pradneyaprabhudesai243
@pradneyaprabhudesai243 5 місяців тому
As a beginner in React , I can confidently say that this video is a must watch
@dawid-bobowski
@dawid-bobowski 2 місяці тому
Thank you for the video. Very useful stuff to keep in mind!
@adhy612000151
@adhy612000151 7 місяців тому
Thanks, so bless me!
@rin0422
@rin0422 27 днів тому
Thank you so much. I learned a lot
@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.
@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.
@navdeepsinghsowanni1658
@navdeepsinghsowanni1658 20 днів тому
I am a senior architect who doesn't code anymore. Have interview coming up for which I had to do quick POCs to learn React, I was making same mistakes. This is super helpful
@BrunoSilva-vw4uo
@BrunoSilva-vw4uo 6 місяців тому
The video is totally necessary! Good job dude!
@Furki4_4
@Furki4_4 5 місяців тому
Thanks for the video, really helped me a lot ! Especially the 12/12 helped me to understand why my states weren't getting updated xD 4/12 - I always try to avoid duplication in my code however, I obey the Rule of Three of "Rules of Thumb" as well. If the logic isn't too long and/or complicated, I might tend to duplicate it instead of abstracting it until the third duplication. 2/12 - not cleaning the interval causes incrementing the count by 2 on my side.
@ByteGrad
@ByteGrad 5 місяців тому
Thanks, appreciate it!
@tghhh19
@tghhh19 4 місяці тому
Great video, thank you for creating this.
@jameskayihura1675
@jameskayihura1675 4 місяці тому
Thanks you very much, I ran through this situation
@emreq9124
@emreq9124 7 місяців тому
I also add the point: stateSetters arent asynchronus functions. Ther are synchronus functions. You cannot use await with them. React dispatches the setterMethod immediately, but it schedules to state update and try to optimize rerenders for current scope. So, it "will" update the state in the future
@snakesoul
@snakesoul 8 місяців тому
As a learning developer, I run across hundreds of baity videos, but this one was really useful
@user-zo5wp3su8y
@user-zo5wp3su8y 14 днів тому
Great Explanation. Thanks!!!
@KeshavAneja
@KeshavAneja 3 місяці тому
Thank you so much for this amazing video!
@lucasa8710
@lucasa8710 7 місяців тому
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
@anoopisaac
@anoopisaac 7 місяців тому
Great content, good insight into how react works and simplify coding. But not sure about the stale closure you explained. I think setInterval still has reference the 'count' variable and it gets value out the count variable using lexical context but issue here is when the component is rendered, reactjs discards previous 'count' variable which still holds 0 and creates a new one while the 'setinterval' still refers to the old one.
@aadispare3673
@aadispare3673 5 місяців тому
The interval was created at the time of mounting of the component, when the count was 0. Since it wasn't cleared in the first example, it lived in the context with lexical access to count=0. The count changed on every render, but interval wasn't destroyed/recreated to have access to the latest count value.
@funkerosupremo
@funkerosupremo 5 місяців тому
As I was watching, there was this sudden urge to like the video multiple times, even though i'd already liked before. Learned a lot, thanks!
@amir7440
@amir7440 8 місяців тому
A bit of advice, if you don't want to get stuck with stale states when you're updating your state based on the previous state, always use callback function instead of a raw value inside your updater function. Get used to it and this will save you a lot of time.
@AlexanderSuleymanovFX
@AlexanderSuleymanovFX 7 місяців тому
Thanks for the tip. Can you do a code example?
@orere1635
@orere1635 7 місяців тому
@@AlexanderSuleymanovFX I think what he means is the solution found in the video at: 38:23 setCount((prev) => prev + 1) instead of setCount(count + 1)
@Adventures_English
@Adventures_English 6 місяців тому
@amir7440 to your knowledge are there other cases where not using a callback when setting state presents an issue? Or is this just limited to useEffect?
@amir7440
@amir7440 6 місяців тому
Stale state can happen anywhere, for instance, assume a situation where you have to update your state twice or more in one single handler function. In this situation you should use callback instead of a raw value, because you will not get access to the fresh state unless you use callback. Just keep in mind that we have a so called batching state updates in this particular situation where react will update all of our states in one go (in one render), so we have to enforce react to use the freshest value on each state update. As I mentioned in my first comment, when you want to update your state based on it's previous value, always use callback and you're good to go.
@AlexanderSuleymanovFX
@AlexanderSuleymanovFX 6 місяців тому
@@orere1635 Thank you!
@albertgouws13
@albertgouws13 6 місяців тому
Great video especially the pace at what you presented. It was 👌No time wasting and just kept going.
@krvns
@krvns 5 місяців тому
This is 46 minutes of pure gold! Thank you!
@user-cf6vt1bm1u
@user-cf6vt1bm1u 4 місяці тому
In the first section, I think it's important to point out that the setCount function call isn't really being "scheduled". What happens is the function is run top to bottom (it renders the component), and the handleClick function is loaded and attached to the button with the current value of count. When the button is clicked, count is the same for all calls of setCount. For example, if you put a loop inside the handleClick function that takes 5 minutes to complete in between two setCount calls, one button click will still result in a single increment. Promisifying and awaiting has the same effect.
@Cmacu
@Cmacu 4 місяці тому
Thanks for saying this. This and some of the other explanations and examples in this video are very misleading and sometimes even flat wrong. It’s crazy how many people are just admiring the effort and taking it at face value without noticing the mistakes/problems. Another obvious example is the explanation about fetching data in useEffect without addressing the asynchronous nature of the fetch api and including practically required concepts such as async/await… There are other bad examples such as the resize listener which if declared as per the example will clear all resize listeners across the whole application and etc. I can keep going, but essentially almost every single example in this video has an issue. And we wonder why junior developers make such mistakes… because they watch videos like this one which demonstrate one type of error only to replace it with another…
@alexandergrigoryan3359
@alexandergrigoryan3359 8 місяців тому
this video is a pure gold for any React developer, junior and intermediate
@christianstander5452
@christianstander5452 8 місяців тому
Wow this was super valuable. Thank you 🙏
@maherylala2153
@maherylala2153 4 місяці тому
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 👍
@411sev
@411sev 6 місяців тому
A well presented tutorial. Concept are explained very clearly with very short but good examples to facilitate understanding. Thank you very much.
@TheMaxZakh
@TheMaxZakh 7 місяців тому
this was great, thanks!
@MustafaAhmed-lo7vb
@MustafaAhmed-lo7vb 6 місяців тому
Very helpful information i never seen before it can minimize my code alot thank you very much
@shafiemukhre
@shafiemukhre 6 місяців тому
really good, thank you for creating this! More contents for professional react developer
@whatskookin6429
@whatskookin6429 2 місяці тому
You explain it so good brother, thank you!
@zuka1100
@zuka1100 3 місяці тому
One of the best react videos I have watched. Simple yet wholesome 👍
@asuosnotielc
@asuosnotielc 7 місяців тому
Great tips! Thanks a lot!
@gjcardonam
@gjcardonam Місяць тому
This ASMR React Class was amazing. Thanks!
@vyacheslavkara7554
@vyacheslavkara7554 8 місяців тому
I think a better solution for the condition rendering problem is to create two new components and have the condition outside of them, then you will not get the error. The problem with your solution is that useEffect and the useState still do some work but should not until you have the id and this does not scale well if you have something significant in the useEffect for example.
@itsmepawan
@itsmepawan 4 місяці тому
Loved the video. Subbed 🙌
@john_dren
@john_dren 8 місяців тому
I finally understood the relevance of the spread ... operator with your real world example. Thanks to you
@eddiegere
@eddiegere 3 місяці тому
Amazing video with valuable information. Thank you.
@saputrauta09
@saputrauta09 6 місяців тому
you are a great teacher!, thanks!
@programmingwithnit5308
@programmingwithnit5308 7 місяців тому
Thank so much 🎉
@lionmike247
@lionmike247 8 місяців тому
This video is well explained! So useful and great for review. Excited for your course!
@anthonyezeh7511
@anthonyezeh7511 6 місяців тому
You simplified a lot for me♥️
@maurov2104
@maurov2104 8 місяців тому
This video shows how counterintuitive React is!
@saurabh75prakash
@saurabh75prakash 7 місяців тому
This is an excellent refresher for intermediate react devs. Thanks 🙏
TypeScript in React - COMPLETE Tutorial (Crash Course)
53:21
ByteGrad
Переглядів 175 тис.
Web Developer Roadmap (2024) - Everything is Changing
25:02
ByteGrad
Переглядів 207 тис.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Переглядів 18 тис.
You might not need useEffect() ...
21:45
Academind
Переглядів 126 тис.
6 State Mistakes Every Junior React Developer Makes
15:53
Lama Dev
Переглядів 261 тис.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Переглядів 283 тис.
This is the Only Right Way to Write React clean-code - SOLID
18:23
CoderOne
Переглядів 612 тис.
Goodbye, useEffect - David Khourshid
29:59
BeJS
Переглядів 491 тис.
Why use Type and not Interface in TypeScript
14:12
ByteGrad
Переглядів 184 тис.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Переглядів 440 тис.
State Managers Are Making Your Code Worse In React
13:33
Web Dev Simplified
Переглядів 131 тис.
STOP using useState, instead put state in URL (in React & Next.js)
21:41