Learn useEffect In 13 Minutes
HTML-код
- Опубликовано: 8 май 2020
- 🚨 IMPORTANT:
Full React Course: courses.webdevsimplified.com/...
1 Year Free Hosting: www.atlantic.net/webdevsimpli...
Use code KYLE for an additional $50
In this video I cover everything you need to know about the useEffect hook. I compare this hook to the old way of doing things with lifecycle methods in class components so you can understand how to start using hooks effectively in your projects. This is part of a series of React videos where I cover all the important hooks in React.
📚 Materials/References:
useState Video: • Learn useState In 15 M...
useEffect Blog Article: blog.webdevsimplified.com/202...
React Hooks Playlist: • React Hooks
🧠 Concepts Covered:
- How to use hooks in React
- How to convert class lifecycle methods to function effects with useEffect
- How to use the useEffect hook
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
#ReactJs #WDS #useEffect
One note at 5:00 for people newer to React. If you try to update state with setState (setResourceType in this case), but the value is the same as the current state, it won't trigger a rerender. This is because of the way the React team has chosen to implement useState (it helps to prevent unnecessary rerenders). This can become an issue when your state is an array (or an object), as you can mutate the array, try to update state, and it may not trigger a rerender because React thinks the array is the same (since the array reference is the same). You can solve this issue by using the spread operator (...) to create a truly new array or object: setState([...array]) or setState({...object}). More info on that at if you Google something like "usestate update not always triggering rerender component"
Thanks for this heads-up. It's something really useful to know
Correction: if you use _setState_ it will always re-render.
I found that out early on. There is this rule in React that "one simply doesn't mutate state" and it applies to hooks as well. React uses Object.is() to check for equality between the previous state and the new state, and if you mutate an array or object, it is still the same object and so it won't update.
@@prince5922 no
@@prince5922 No, it the value is same as before it won't re render. You need to spread
You have the gift of breaking down any difficult topics in a way that everyone can understand.
I wish there was a super like button on RUclips 👍
I thought so too, he can probably bundle this up and make it into an in-person bootcamp and charge 15k per head.
yes, he is that guy.
super like from here
I saw many videos on hooks before, but this one only makes me understand completely in detail and in first attempt only. Thank you so much.
The subscribe button.
I paid money for a full react course on udemy and after every hook I "learn" from there, I come to your channel to see it reexplained better. 😅
course by whom?
Me too! hahah!
Yes, me too..
Me too. lol
Lol me 2
The fact that the clean-up code runs before the event listener is a key point that's rarely communicated in docs, tutorials, etc. Very well done!
Yes, I agree 100%! 😉
Can you explain Two things why App being rendered twice, when you click post twice, I mean when you clicked first time, I understand app being rendered, but when you clicked again on Post.
The app shouldn't get rendered as state is already same.
Second why useEffect ran twice, even though you are not using StrictMode
*Kindly help !!!!*
I knew he was going to be good when he starred directly into my soul
You are incredible! I'm self taught and employed as a full stack engineer, so I've been able to find some high quality tutorials on my journey. But you my friend, are truly an incredible teacher on intermediate/advanced language topics and I hope you continue to keep making these vids!
ditto man! hes a beast!!
dude I wish I had met this channel sooner. You're amazing
This is the most understandable explanation I’ve ever found. Good job mate and thanks.
I’ve now watched a couple of your videos for different react hooks and they’re great. Really clear and to the point. Thank you Kyle
I'm primarily a backend/infrastructure dev and have been struggling with some very basic React concepts. I watched your useState video first and you did a fantastic job breaking it down and simplifying it so that my smooth brain could understand it. You've done a fantastic job here too. Well done!
Man, I have the same issue, of course I'm just a student right not, but the useState was a killer video for me. With that video I understood a lot of react but this useEffect is mind blowing, really funny how a lot of people love React but it is kind of complex to get it when you advance to the second page which is like, man is this so freaking easy? hah
@@veoquenoesunproblema That is because people are learning ONLY React, which relays on JS, pretty much.
Good video, however this guy like almost ALL people try to assign the lifecycle to useEffect. But it is not pretty much the case because functional components behavior different from react classes, Dan explained in its blog ALL DETAILS.
Also this guy does not talk about Closures and why it is important to know them... (Course because people do not learn javascript but react)....
Extremely Useful, I've just picked up react and these small doses of lectures are really making the difference.
Thanx, Kyle.
Kyle is the best ,he explains so much things in a very time span.Other channels sometimes confuses me with so much mess.
You are a genius. The way you explain things and connect the dots is simply awesome. It is very easy to connect to what you explain and easily get accustomed to new technology . Great Going bro, keep it up :)
This guy is really awesome, talking too slowly but telling a lot of the topic for making it much easier, love u man 💚
Kyle, every single time I feel that I don't understand something as good as I'd want, either it's html/css/js or react, I go and search a video on that subject from you. It's been a year and a half and it worked every single time. And I want to thank you for that! You're awesome.
You are the best man. So quick and easy to understand when you teach it. Can't believe I've been putting off taking the time to learn hooks when all it would have taken was a 13 minutes with you👍🏼
Hey Kyle thank you for this new series.
I've been a rough time trying to study steadily while working from during this quarantine. This new series got me back on track. Waiting for the next episode!
What do you do now just curious 🧐
Wow, this is the best explanation I have ever seen so far. My respect.
Once again knocking it out of the ballpark
every video of yours i search for because I am trying to understand a seemingly impossible concept, I leave 15 minutes later having a great understanding. 100% live up to your name, Web Dev Simplified
I understand more in the last 30 minutes than I did 8 hours of lectures and workshops ago. Thank you so much!
Everything about you is cool , from hairstyle to voice to explanation
Learn from the enlightened
FINALLY!! After reviewing a ton of tutorials and explanations, I could finally understand what this hook was for! Thanks a lot!
As usual, thank you so much for your explanations. By far the best resource for web development on RUclips!
you're a life saver and amazing teacher
You are awesome man! You explain things in a very simple and comprehensive manner, thank you :)
This is the most understandable explanation I’ve ever seen
One of the best tutorials ever
Simple clear explanation of the basic concepts. Very helpful. Thank you.
Any time I watch your videos, you connect the dots for me. Thank you for everything.
You definitely have the teacher mindset. Really clear!
The best REACT explanation on RUclips. Thanks.
You tone is so smooth I can understand you code without looking at screen.
Thanks for such great videos
Thank you so much!!The examples were quite easy to understand.I got it so well.I wish you the best!
This is the best explanation one can get on internet !!!! Simply wow . Thanks for the tutorial
This video makes useEffect so clear and I feel like I finally understand it now thanks to you!
So many times used useEffect but now i understand properly, respect for you sir.
This video is incredible, thank you for explain so easier topics that seem impossible to understand!!
6 minutes of this video and i understand use Effect, something that i didnt understand in one hour lesson. Thank you very much 😊
I have to say this is the best explanation of react hook
Thank you man. Keep making these types of videos. I love them all. Very cool precise and clear. No b.s.
As always: simple and clear explanation! Thanks!
You have a gift man, I really understand when I watch your videos!
i have no words which can appreciate your work.
was struggling all day with this thing, now its like crystal clear lol thank youuuu
Thank you very much 🙏, It was a very clear explanation with sufficient but short examples.
Solved a massive pain in the ass 4 minutes, 6 seconds in. Best subscription I ever made here.
amazing explanation in such a short video, thank you!
man u are awesome the way u explain things in a simple manner really helps a lot for the people keep up doing the good stuff..
So clear... I was struggling with this concept, now it's ok, thank you very muck Kyle !
wow. never seen state being used to fetch data dynamically like that with the press of one button! awesome!
Thanks for this video. Fast, simply and well explained
Amazing video thanx Kyle actually going to start using hook now!
Simple and no clutter, great one.
I just love the way you explain Very straight forward!
Excellent examples, very clear explanations, thanks!
Great explanation of something i always found very abstract, thanks!
You have the perfect articulation. Great stuff, thanks.
Man you literally are a god to me! I learn more from you than at University!
yo man hats off to you man you can break any complex topic into simple pieces love your vids man.
Thank you Kyle...... Your video is very helpful for the beginners like us!
Your videos are very easy to understand. Thanks for the content.
Dude you explained is so easily, simply amazing man 🔥
3 different YT videos taught me how to use the useEffect hook but I only learnt it when I saw your video.
Really great explanation! Thank you!
close to nine months not understanding useEffect, thans for your help. It was the best one
You're the best, I'm starting to learn React Native and I'm looking forward to have my questions answered by you!
Love your videos. Explanations are clear
Your channel is a game changer. Thanks Kyel!
Fantastic tutorial as always!
wow.. that clean up thing just blew my mind. I have been a react developer for a while now, still didn't know this. Well everyday we learn, we grow.
Best explnation I have come across for the react hooks !!
very good tutorial! I understood this sentence and i hope that I will make bigger progress! Thank you!
Wow, super easy to follow along, thank you for sharing this with us :)
Subscribed!
Thank you. I fully understand React hooks in really really 13 mins.
Great explanation as always, Thank you very much!
very much comprehensive and intuitive video, Great work thank you :)
thanks for breaking this down so well, I finally understand what's going on!
The name of the channel really speaks for itself. Thank you for this
This was a great explanation! Thank you!
Thank you! Such a great tutorial!!
Thanks, you made this easier for me to understand
Wow thank you, bro, now I have a clear idea on useEffect
Thank you Kyle so clear explanations.
Great rundown. Thank you man.
Very simple explanation, thanks!
I had better luck with you than my prof. Thanks a lot!
Your videos are too great, I have no words to thank enough.👍👍🙌🙌
YOU ARE INCREDIBLY TALENTED ! MANY THANKS
Thanks dear.. it was nice learning from your tutorial
Incredible help, thanks Kyle!
Awesome explanation. You made my task easy
Thank you for this. Finally understood useEffect and useState
Thanks Kyle, Amazing tutorial
honestly, along with this dope explanation, i recommend just reading the react docs, they are well explained and easy to digest.
Great explanation. Thank you. I am your fan
bro you are the best in explaining things!!!
Thanks man, you save me reading about side effects in the docs haha :). Cheers.
very concise and well explained!
You are a Genius man! 💯👌and you really really know how to explain. Thank you man