Full React Tutorial #24 - useEffect Cleanup

  Рет қаралды 220,742

Net Ninja

Net Ninja

Күн бұрын

Пікірлер
@geometrydashjowinator1936
@geometrydashjowinator1936 Жыл бұрын
For anyone who didnt get the error message (kinda ironic that we want to get an error message), my best bet is that react handles that by it self on newer versions. I still followed along with the rest of the video and had no problems so I'd advice you to not stress about that and keep enjoying the tutorial
@feliciaf8
@feliciaf8 Жыл бұрын
ooo that's why i didn't get it
@mihajlocolic01
@mihajlocolic01 Жыл бұрын
I just thought of googling if that's covered in newer versions. Thanks for letting us know.
@frontend3409
@frontend3409 Жыл бұрын
I assumed that's because i've used v6 (still followed along with the videos), but looks like it's not. thanks
@berzolka
@berzolka Жыл бұрын
Thanks for the info. It was a bit confusing. that I didn't get the error.
@izleogrenkodla
@izleogrenkodla Жыл бұрын
It is not new v6 react-router, it is newer version React. So you will not get an error since React will automagically handle it.
@waynetasaki
@waynetasaki 2 жыл бұрын
To everyone who didn't have an abort error but then when creating the cleanup function you got an error each time the page loads - REMOVE both React.StrictMode tags that wrap your component in your index.js file. I believe since strict mode is enabled, certain functions are fired twice and that's what causes the error to load even when you're not doing anything to truly abort the fetch. If you want, you can just leave the strict mode tags and understand that in production, you would not receive the Abort Error and nothing is inherently wrong with your code. I hope this helps others who were stuck trying to understand why the hell the Abort Error kept popping up. 😀
@youssefmokhtar1058
@youssefmokhtar1058 2 жыл бұрын
I didn't get an error in the first place, is that because I'm using version 6 of react router instead of 5?
@sahajatantra
@sahajatantra 2 жыл бұрын
Thanks so much. I was wondering about this. And i was already wondering for quite a while why certain functions are always fired twice - now i finally know.
@therameez92
@therameez92 2 жыл бұрын
Thank you, your comment answered my questions.
@frubas4127
@frubas4127 2 жыл бұрын
I was about to go mad because of this :)). Looked for an answer on this on the internet for a while now. Thank you so much. You just saved me minutes if not hours of just browsing the web
@alaasayed6508
@alaasayed6508 Жыл бұрын
thanks for ur comment , it really helped me
@kristofferjohansson3768
@kristofferjohansson3768 3 жыл бұрын
And all of a sudden I coded all 24 episodes. This is more addictive than Game of Thrones once was! I need more :)
@raymondmichael4987
@raymondmichael4987 3 жыл бұрын
He has a way of ending an episode which make you wish for more.
@ericmomoh7927
@ericmomoh7927 2 жыл бұрын
Exactly and is way enjoyable.
@reenasoni3938
@reenasoni3938 2 жыл бұрын
hahaha
@soumadip_banerjee
@soumadip_banerjee 2 жыл бұрын
Kudos ❣️😊
@jeeadvanced1230
@jeeadvanced1230 2 жыл бұрын
Yes ❤❤❤❤❤❤❤
@jasper5016
@jasper5016 2 жыл бұрын
I cannot believe that I started this series, finished 24 episodes and coded them as well. Thanks a lot for being an awesome teacher.
@Hacking-NASSA-with-HTML
@Hacking-NASSA-with-HTML 2 жыл бұрын
Hi! Did you make it in a single day 🤔?
@SergeiFedorov77
@SergeiFedorov77 2 жыл бұрын
These tutorials are great! Many years ago I watched your vue/vuetify tutorials and I've been using those at work since then with great success! Now I'm aiming at learning react which is not too hard after knowing vue. Two notes: I'm on react v18.2.0 and react-router-dom v6.4.3 and using React.StrictMode makes the "useEffect" run twice. Furthermore the routing seems to be "exact" by default now and switching routes while the fetch of data still is in progress does not seem to cause an error.
@Hacking-NASSA-with-HTML
@Hacking-NASSA-with-HTML 2 жыл бұрын
exactly 👍 and react-router-dom is v6.6.1 Everything Changes quickly😁
@newesttechdesigninnovation8121
@newesttechdesigninnovation8121 Жыл бұрын
Im in a coding bootcamp called nucamp and your videos help me more than them. Omg your the only coding youtuber i understand trust.
@mustafasaitkonuk3519
@mustafasaitkonuk3519 Жыл бұрын
I am confused. I don't get an error like you said but i don't get console message "fetch aborted". IDK what i have done wrong :D
@feliciaf8
@feliciaf8 Жыл бұрын
same it doesn't cause even if i don't use clean up
@Pupu._
@Pupu._ 4 жыл бұрын
best, best, best teacher ever
@NetNinja
@NetNinja 4 жыл бұрын
Thank you!
@mkmalikcom
@mkmalikcom 4 жыл бұрын
ya, right 👍
@MasterMathematicswithMatthias
@MasterMathematicswithMatthias Жыл бұрын
It's like telling an interesting story. I cannot stop wachting it. I put this whole weekend on this.
@DragonwingZify
@DragonwingZify 2 жыл бұрын
In the documentation about the React.StrictMode if anyone is using version 6. They introduces a new development-only check to Strict Mode. This new check will automatically unmount and remount every component, whenever a component mounts for the first time, restoring the previous state on the second mount. Basically from what I've read is, they are saying we don't have to use the useEffect Cleanup because the React.StrictMode is handling the function for us. If anyone has an idea of why we should still use the AbortController I would like to know.
@wheeler553
@wheeler553 2 жыл бұрын
Yeah idk, I removed Strict mode and I'm still not getting any error in the console and everything is working fine
@leonardomalave2569
@leonardomalave2569 2 жыл бұрын
@@wheeler553 same as you but im using 5.3.4 version, but are u getting functions fire twice on console?
@wheeler553
@wheeler553 2 жыл бұрын
@@leonardomalave2569 yes
@art1co
@art1co 2 жыл бұрын
@@leonardomalave2569 me too, i dont have the error and i'm having the function twice in th console, if i cut the switch mode, i don't have the print out twice anymore, but still no error for the unmount if i don't have the clean up, annyway, great tut anyway
@astik2002
@astik2002 Жыл бұрын
so all in all, if Im using v6 of react dom I don't need to use useEffect Cleanup??
@LiteBusigt
@LiteBusigt 4 жыл бұрын
Thank you for these videos. You are honestly the best teacher on KZbin I have found. I watched your Flutter&Firebase series and loved that too, thank you!
@whereislolly
@whereislolly 3 жыл бұрын
This is the most beneficial channel on KZbin. Thank you so much, Shaun.
@afxcrush41
@afxcrush41 3 жыл бұрын
This is the most understandable and precise tutorial series of all youtube
@vikash-kumar-gupta
@vikash-kumar-gupta 3 жыл бұрын
While learning React on this tutorial here, I did also learn about cancelling any API call before component tear-off. Thank you for making other related concepts clear through your videos. This learning can be utilized in any framework while doing fetch and cleanup.
@nikhildhakal3727
@nikhildhakal3727 2 жыл бұрын
Didn't get the mentioned error but seems its better to add this in case of slow servers. Worked smoothly.
@Troglodyte2021
@Troglodyte2021 9 ай бұрын
I tried setTimeout to 3 seconds, still no error. I guess I will simple skip this video and move on to the next. :)
@Corolley
@Corolley 3 жыл бұрын
Mr Net Ninja, I normally don't post a comment under any KZbin video but I just want to thank you for your video's. You've got a talent for clearly explaining the syntax and logic of React and React-based frameworks. Without your help, I'd still be tasting in the dark. Keep it up, and I will foward your video's to my fellow colleagues, they'll for sure love them too!
@saida584
@saida584 3 жыл бұрын
Thank you, Master. You charged my day with the extra mile with tuts. As always you are the best. Thank you very much for this cleanup video
@TheBobby2908
@TheBobby2908 3 жыл бұрын
this channel is a goldmine.
@DebugWithAdam
@DebugWithAdam 2 жыл бұрын
I just revised myself in less than 48 hours, great content
@michaeleyitayo
@michaeleyitayo 3 жыл бұрын
Omo. Thanks so much for explaining clean up like this. This is the best I've seen so far
@raymondmichael4987
@raymondmichael4987 3 жыл бұрын
I can finally cross this off the list, cleanup was such a big pain in my head. I had to visit this series hoping you can help, it was a perfect guess. Thanks dude, happy break.
@andrewperez7844
@andrewperez7844 3 жыл бұрын
Wow easily the best explanation on this topic! I feel like this was overlooked by people when they teach useEffect. Would have never known about the about signal. Thank you!
@hm.8211
@hm.8211 Жыл бұрын
this is so addictive. great tutorial!
@moisen8773
@moisen8773 4 жыл бұрын
Hi Shaun, is it normal that I am not getting any error?, like you had. Even before I add the cleanup function, everything seems to be working correctly. When I write the return function in useFetch, and console.log('fetch aborted'), I can see the log in the console. But when I add the if/else statement in the catch err function, and return ()=> abortCont.abort(), I am not receiving any log, and no error, every thing still work... 🤔. Sorry but when I am not seeing any error, and all still works, that's weird and suspicious 🤨. I must be missing something.
@alexander5582
@alexander5582 3 жыл бұрын
If remove artificial setTimeout func -> there won't be any err-s at all (had the same question)
@moisen8773
@moisen8773 3 жыл бұрын
@@alexander5582 Thanks, for the info.
@chrisandrew8646
@chrisandrew8646 3 жыл бұрын
I have the same problem... or actually... lack of problem. I am wondering why I am not getting the error that should be generated by jumping between the buttons at the 0:32 mark... thanks
@bidishapal4339
@bidishapal4339 2 жыл бұрын
Stuck in that exact same point. Not getting any error. Also, when I write cleanup in console, while switching b/w pages, it comes like - Cleanup Cleanup Cleanup While the message in the video comes like - Cleanup (1) Cleanup (2) Cleanup (3) No clue where I went wrong!
@voice_famous_books4301
@voice_famous_books4301 2 жыл бұрын
I asked the same question above. So I'm hoping someone to answer that:)
@webdev4786
@webdev4786 3 жыл бұрын
you are my best teacher... one day I might meet you in person and thank you for all you have done.
@nanayawfreduah
@nanayawfreduah 3 жыл бұрын
Thank You Very Much For The Precise Yet Indepth Explanation
@IvanBankovic-k6n
@IvanBankovic-k6n Жыл бұрын
If it aborts the fetch why it does not abort it immediately but only after you click on another page?
@boyiscola
@boyiscola 2 жыл бұрын
If the cleanup message is not working as in the video, comment out React.StrictMode in index.js.
@tichaa
@tichaa 2 жыл бұрын
This was quite helpful to me
@omeatai
@omeatai 2 жыл бұрын
Thanks a bunch! I was looking out for the solution.
@andromilk2634
@andromilk2634 9 ай бұрын
By curiosity, why is it that you keep talking about state of the Home component even though we have moved the state instead to a hook? Isn't the state the exclusive property of the hook now, and we're just receiving the data from it to our component? (Which happens to be unmounted by the time the fetch has finished) Or am I not understanding?
@wheeler553
@wheeler553 2 жыл бұрын
I'm not getting the error you're displaying, I'm using async/await instead of promise chaining and I have the setTimeout on as well, but everything is working fine no errors thrown.
@neoz225
@neoz225 Жыл бұрын
U don't need cleanup anymore for react router v6, it's handled by itself using the new routing method i.e component routing
@BearIsAwesome97
@BearIsAwesome97 Жыл бұрын
The best tutorial on react
@Dexter101x
@Dexter101x 3 жыл бұрын
With your accent, I thought y you meant something else at 2:55 🤣
@JesusSanchez-cd3ze
@JesusSanchez-cd3ze 3 жыл бұрын
Lmao
@petarp3938
@petarp3938 3 жыл бұрын
Lol right, i came down to see if someone else already commented on it. "ye fookin cont" i bet he says.
@tomasburian6550
@tomasburian6550 Жыл бұрын
Good job, Mr. Ninja, learned a lot!
@elgizhasanzada
@elgizhasanzada 2 жыл бұрын
This annoying warning finally solvedd damnnn. Thanks so much
@shadebinder3599
@shadebinder3599 Жыл бұрын
i dont get the error you get from switching pages quickly, does this have to do with something about how from react 18 it automatically mounts and mounts or something when you first load? I always get two usefetch messages bec of that
@geometrydashjowinator1936
@geometrydashjowinator1936 Жыл бұрын
Who would have thought that not getting an error would be a bad thing lol. i didnt got it either, my guess is that newer versions of react handle that for us
@Unknown_22-z8c
@Unknown_22-z8c Жыл бұрын
Does v6 react router dom automatically handles abort controller, because it seems i'm not getting any warning messages even with commenting react.strictmode?
@destroyerajdev
@destroyerajdev Жыл бұрын
I think it does so, I've been trying to get the error but it hasn't popped up
@rexrider4916
@rexrider4916 Жыл бұрын
i also think it does i cannot get the error
@ebadrahman1832
@ebadrahman1832 10 ай бұрын
best tutorial in the web ❤
@NetNinja
@NetNinja 10 ай бұрын
Wow, thanks! :) hope it was helpful
@voice_famous_books4301
@voice_famous_books4301 2 жыл бұрын
Hello and thanks The Net Ninja:) My code doesn't show an error about fetch even when I don't use 'AbortController'. Why? My React version is 18.1.0 and RRD version is 5.3.3 . Is it relevant to my versions?
@avatr7109
@avatr7109 3 жыл бұрын
HOLLLY FOCCK this is the 24th Lesson i dont know how much time I Sat . This is so well Taught....its addictive 🤪🤪🤪
@icetmzz9074
@icetmzz9074 2 жыл бұрын
im using v6 and not getting this error. Why's that?
@yogyyconst
@yogyyconst 2 жыл бұрын
because you using v6
@jeffgoes4116
@jeffgoes4116 3 жыл бұрын
Thank you for an amazing explanation!! I have a question You showed us how to use the signal parameter in a fetch method but what if we used other http client like axios?
@saidakhmedagitaev
@saidakhmedagitaev 3 жыл бұрын
Thanks for the series, Shaun. Is there any chance to show us how to use less common hooks (useMemo, useRef etc.) as well, as a part of the series?
@NetNinja
@NetNinja 3 жыл бұрын
Hey, those two hooks are not in this series, but I will be making some more one-off videos about lesser-used hooks at some point in the future.
@khushikavya2555
@khushikavya2555 Жыл бұрын
can anyone help with "Failed to fetch" error ?
@himalayagupta7744
@himalayagupta7744 3 жыл бұрын
You are one of a kind. Excellent Teaching
@israeldearaujo94
@israeldearaujo94 2 жыл бұрын
I used async await instead of then and I did not use setTimeout. It worked well and I didn't see the error showed in this video. And I tried a lot of times.
@wheeler553
@wheeler553 2 жыл бұрын
me neither...
@yoooc25
@yoooc25 2 жыл бұрын
thank for this best toturial, one question, when i'm clicking the home or the New Blog link in the navbar i see the browser change to correct link but the page not changed. only if i'm clicking "enter" on browser to link that changed i'm getting the right page.. Someone help?
@David-fy1sn
@David-fy1sn 3 жыл бұрын
Is there a possible link to know or understand why or when the abort signal is fired off?
@VoxyDev
@VoxyDev 3 жыл бұрын
lol udemy instructors are shaking if u continue to keep your work as greate as this :)
@AtitManandhar
@AtitManandhar Жыл бұрын
Thank you for this knowledgable content. Really appreciate it.
@jamesmalarkey7437
@jamesmalarkey7437 3 жыл бұрын
Tight, Tight, Tight. React, Vue, Angular doesn't matter just keep teaching me it.
@majdkhasib76
@majdkhasib76 3 жыл бұрын
I thought that I am good in React until I saw your AMAZING videos! I will recommend them for my firends as well! Thank you so Much sir!
@MustafaMohamad-nd9bw
@MustafaMohamad-nd9bw Жыл бұрын
Great tutorial, thank you. is it possible for the home component to be unmounted right after the fetch but before all the states finish updating. If so, I guess we would have to handle this case.
@chrisandrew8646
@chrisandrew8646 3 жыл бұрын
I'm not able to replicate the error message that should be generated by quickly clicking between the "Home" and "New Blog" buttons... I've tried setting my network speed to simulate a slow 3g connection... I've also tried increasing the time of the setTimeout function. Can anyone advise what is a possible way to simulate the error message. My code is exactly spot on in line with the tutorial... perhaps some Chrome setting? idk... 8) thanks. These tutorials are excellent. What a wonderful instructor and teacher.
@chrisandrew8646
@chrisandrew8646 3 жыл бұрын
Hello, I thought I'd share what was causing me not to see the error message as it appeared in the video. I noticed that I actually wasn't ever reaching the Create.js component, and it was down to having left out the "exact" part before the Route path attribute in the App.js file... doubtful that anyone will be having the same issue due to the same oversight, but the moral is to check your code... check, check and then double check. And thanks again to the NetNinja for these amazing tutorials. Thanks
@RadeonVector
@RadeonVector 2 жыл бұрын
I still get the "Warning: Can't perform a React state update on an unmounted component. " error, anyone figured out what's up?
@shashankpandey1966
@shashankpandey1966 3 жыл бұрын
short and to the point ...Thanx a lot.
@emiliomaalouf5101
@emiliomaalouf5101 2 жыл бұрын
I wasn't getting the error before when I was switching really fast between pages and also, when I was using the console.log thing to display a message it was doing it whenever I switch. Now that I'm using this it keeps giving me fetch aborted whenever I load the home page and after i get the data. Anybody knows why ?
@lomeinmaster
@lomeinmaster 2 жыл бұрын
I'm having the same issue. Did you find a solution?
@lrajoo11
@lrajoo11 3 жыл бұрын
thanks for adding this - just got this error :)
@BackyardniJuan
@BackyardniJuan 2 жыл бұрын
im not getting that can't perform error in class component "react": "^18.2.0",
@mj2758
@mj2758 2 жыл бұрын
SAME
@rehanayoub4574
@rehanayoub4574 3 жыл бұрын
Please also create a tutorial for testing for both react and nodejs and how to mock db calls and api. I want to learn integration testing and unit testing using any javascript testing framework
@Abogida11
@Abogida11 3 жыл бұрын
When I switch from one link to another I don't have that error message in my console...as Net Nonja has it.what's going on?
@_swordancer_
@_swordancer_ 3 жыл бұрын
Shaun I have just found Your video on Brad Traversy channel, I have looked through it and it is next on my list after this react tutorial :)
@saketaryan2227
@saketaryan2227 3 жыл бұрын
Awesome videos...love from INDIA
@akshaypendyala
@akshaypendyala 3 жыл бұрын
Hey Shaun i got this warning when I used abort. src\useFetch.js Line 37:6: React Hook useEffect has a missing dependency: 'abortCont'. Either include it or remove the dependency array react-hooks/exhaustive-deps can you explain what this is.
@Tschüss101
@Tschüss101 5 ай бұрын
I need HEEEEELP... I can't get the error😂 I want to GET it. Isn't that weird??
@SAIEN333
@SAIEN333 4 ай бұрын
same with me, maybe this is fixed in new updates?
@ercanyanmaz5624
@ercanyanmaz5624 2 жыл бұрын
Excellent Teaching, Thank You.
@ArlyJuDe1st
@ArlyJuDe1st 3 жыл бұрын
Can someone help me, I always get an error it say "error 'AbortController' is not defined no-undef"
@wolfie1001
@wolfie1001 Жыл бұрын
for those that get this and cant find the answer, as someone said below, it needs to be, new window.AbortController(); rather than just, new AbortController();
@azyjmexcuseokstop924
@azyjmexcuseokstop924 28 күн бұрын
I'm using router version 7 and I did not get any errors when quickly switching back and forth from home to create. Do you think they implemented a feature so that people dont need to clean up their code with router version 7 ?
@samirprasla1770
@samirprasla1770 3 жыл бұрын
i am wating on next video !! one again thank you for your hard work !!
@pawcio17135
@pawcio17135 3 жыл бұрын
This guy is so damn good, i love u mate u're helping me and my friends a lot. Best React tutorial i've ever seen (it's m y first xDD)
@GAGANDEEPSINGH-jx4ky
@GAGANDEEPSINGH-jx4ky 3 жыл бұрын
@thenetninja how do you know that is the point where we ve to write console.log("cleanup") and it ll show when we switch to New Blog ?? Please explain
@sarvarkhalimov111
@sarvarkhalimov111 3 жыл бұрын
Thank you, man. Great tutorial!
@MrVipulLal
@MrVipulLal 3 жыл бұрын
Useful series. Thanks
@AndresVargas-nv8vh
@AndresVargas-nv8vh 2 жыл бұрын
For this chapter after 02/2022 if you have still the issue update: err.name === 'Abort Error' to err.name === 'AbortError'. Example: (you can test it with the console.log) .catch(err => { // console.log(err.name); if (err.name === 'AbortError') { console.log('fetch aborted'); } else { setIsPending(false); setData(null); setError(err.message); } } Note: the setData(null); inside the .catch() is because that removes the All Blogs! information when we receive an error.
@itgiants5218
@itgiants5218 3 жыл бұрын
Woow I have learned a lot of things, thank you so much
@jess140
@jess140 3 жыл бұрын
Great tutorial, you explained things so well!
@work9909
@work9909 3 жыл бұрын
May I know the logic behind why the clean up function is in the return statement? Why it wouldn't clean up everytime when we useEffect? or actually I does abort everytime just we are not catching that, in that case will that err carry onto the next useEffect?
@dylanroberts6217
@dylanroberts6217 3 жыл бұрын
If you're still getting the error, make sure to remove the setTimeout.
@bskull3232
@bskull3232 3 жыл бұрын
No offense, but I don't know if you are being sarcastic or serious. The idea he added the timeout is to simulate a real world Internet scenario. Without the delay sure you will get around without any cleanups, but when you deploy it, it will go wrong.
@nicholassmith6412
@nicholassmith6412 2 жыл бұрын
Excellent video. Very helpful, thank you
@ThirisulaVarahi
@ThirisulaVarahi 2 жыл бұрын
All right then
@oussamaamireche1184
@oussamaamireche1184 2 жыл бұрын
Thank you so much for this amazing playlist 🤩. i just wanna ask a question which is why I'm not getting that error like you do? is it because I am using a new version of react?
@b2elias
@b2elias 3 жыл бұрын
Awesome information my friend, thank you!
@erkanisuf3604
@erkanisuf3604 3 жыл бұрын
This shit right here is GODLIKE , thanks man !
@chethananderson3446
@chethananderson3446 3 жыл бұрын
Loved it🔥
@abbisalmi1948
@abbisalmi1948 3 жыл бұрын
Wicked lesson! thank you!
@EJ-jh1vf
@EJ-jh1vf 3 жыл бұрын
*gets slag pregnant* Slag: what should we do? Me: 3:53
@ms77grz
@ms77grz 3 жыл бұрын
Now I know how 🙂 Thanks Master!
@rakeshchauhan-op8qw
@rakeshchauhan-op8qw 3 жыл бұрын
2:56 - most famous english words.
@nasrinsolati3175
@nasrinsolati3175 3 жыл бұрын
What if we do not get the warning, do we still need to write the abort code?
@sunilanthony17
@sunilanthony17 Жыл бұрын
I have a bit of a problem, everything works but I'm still reaching the abort error message when I load the Blogs.
@kazuoy
@kazuoy 3 жыл бұрын
Thank you very much to show me such a great contents!!
@bskull3232
@bskull3232 3 жыл бұрын
Thanks for your video. Have been learning MERN for a while and stumbled on your video, and I must say I love the style. I'm an old dog learning new tricks -- have been coding in VB since the early 2000s, and since early 2010s doing embedded works. Keep up with the good works! However I do have a doubt -- this fetch abort mechanism might have a problem in extreme cases. If the page change happens between the fetch has completed, while the JSON parser is doing its job, there will not be anything to catch this case, and we will still have the error. Granted, this is a very low chance event as the JSON parser on a modern computer takes microseconds to return, but still with large enough data and many enough users, this can happen. I think a better way is to add a lock variable on the return function, which gates all state updates.
@Chris-yx4gn
@Chris-yx4gn 3 жыл бұрын
Curious here, how would you gate the state updates?
@lskills213
@lskills213 Жыл бұрын
I just wish that I know about the net ninja tutorial at my graduation time...
@heytheremogwai
@heytheremogwai 2 жыл бұрын
do you have to associate abortController with a specific action? can you just have one in the useEffect itself, declared and then return () => abortController.abort()?
@paularosler949
@paularosler949 3 жыл бұрын
Hi! Thank you so much for this tutorial, it is really great!
@thejesudayan7786
@thejesudayan7786 2 жыл бұрын
Hi Ninja, I followed the same code but my page is not fetching the data from json and is neither responding to page change via url or click. /create is doing nothing
@thejesudayan7786
@thejesudayan7786 2 жыл бұрын
please help
@rajchinagundi7498
@rajchinagundi7498 3 жыл бұрын
I got stuck here ,theres a lot going on and i havent had any problems with this tutorial till yet, but am i the only one who feels like this
@PaardekooperJoris
@PaardekooperJoris 2 жыл бұрын
If you're here not getting the error mesage: check your navbar file. I apparently missed the code for vid23 and didn't get the error.
@unknownman1
@unknownman1 2 жыл бұрын
thanks
@zlackbiro
@zlackbiro 3 жыл бұрын
Why abort, look this: 😎 const mounted = useRef(true) useEffect(()=>{ fetch(url, options) .then(res => res.json()) .then(data => { mounted.current && setState(data) }) return () => mounted.current = false },[]}
@trantrungnghia9642
@trantrungnghia9642 10 ай бұрын
I LOVE YOU , MY ONLY GOD
@vanshika3971
@vanshika3971 3 жыл бұрын
where should we place this {signal : abortCont.signal} thing if we are using lazy loading import method instead of fetch, I tried to place it inside setstate and it worked, is this the right way to do it or we should do it in a different way. I did it like const importlang= async (code) => { const lang= await import( `../../languages/${code}/test.json` ); setState(lang, { signal: abortCont.signal }); };
@PatrickPereiraVieira04
@PatrickPereiraVieira04 2 жыл бұрын
Hi there, I've finished the whole project to the end but I seem to still have an issue with this step. Even when I have the same code I still get something strange. From console.log(err.message), the console says "Failed to execute 'fetch' on 'Window': The user aborted a request." but that's just from refreshing the page.
@jsanchez5199
@jsanchez5199 2 жыл бұрын
Had the same experience, I just started learning react yesterday, what I did was remove strict mode from the render, and this error was gone, I'm guessing it has something to do with the app rendering twice on strict mode, but I really don't know why.
Full React Tutorial #25 - Route Parameters
8:03
Net Ninja
Рет қаралды 215 М.
All useEffect Mistakes Every Junior React Developer Makes
22:23
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Learn useEffect In 13 Minutes
13:38
Web Dev Simplified
Рет қаралды 854 М.
Full React Tutorial #27 - Controlled Inputs (forms)
9:27
Net Ninja
Рет қаралды 310 М.
Full React Tutorial #17 - Fetching Data with useEffect
7:55
Net Ninja
Рет қаралды 361 М.
Learn useMemo In 10 Minutes
10:42
Web Dev Simplified
Рет қаралды 493 М.
React Hooks Course - All React Hooks Explained
1:26:21
PedroTech
Рет қаралды 1,1 МЛН
10 React Antipatterns to Avoid - Code This, Not That!
8:55
Fireship
Рет қаралды 776 М.
Full React Tutorial #21 - The React Router
8:22
Net Ninja
Рет қаралды 531 М.