Learn React Hooks: useImperativeHandle - Simply Explained!

  Рет қаралды 24,487

Cosden Solutions

Cosden Solutions

Күн бұрын

Пікірлер: 65
@cosdensolutions
@cosdensolutions 8 ай бұрын
Hope you enjoyed the video! I also have a really cool and unique course that will teach you way more than this video. You'll learn how to build an actual complex project with React. It's called "Project React" and you can find it at cosden.solutions/project-react. Also, I have a free weekly newsletter called "Import React" with tutorials, news, and cool stuff about React! You can sign up at cosden.solutions/newsletter?s=ytc
@yitzchaksviridyuk932
@yitzchaksviridyuk932 Жыл бұрын
Dude are you kidding me? I didn't know this existed, so at one point, I actually implemented an event bus class just to allow the parent to rerender specific children. I really didn't want to make the class, since I didn't want to start doing things that weren't "React-y" which could confuse other devs; but I didn't think I had a choice. I also did a ton of searching, but maybe I didn't ask the right questions, since I only kept seeing people say that I need to lift the state up etc. Either way, thanks a lot for this video. I kept thinking, "It's so weird React doesn't have a built in way to solve this issue." Good to know that isn't the case. 😄
@cosdensolutions
@cosdensolutions Жыл бұрын
haha yeah, it's not that popular unfortunately, and a lot of people don't know it exists. I myself only found out about it at the beginning of this year hahah
@yitzchaksviridyuk932
@yitzchaksviridyuk932 Жыл бұрын
@@cosdensolutions I hear man. Thanks again!
@firekeeper7461
@firekeeper7461 Жыл бұрын
I searched many videos about this hook on my native language but these guys couldn't explain it simple. Thank you!
@codecleric4972
@codecleric4972 7 ай бұрын
A senior engineer at my job implemented a solution with this to solve a problem I was racking my brain over. It's really powerful and good to know about. This needs to be common knowledge
@tomasburian6550
@tomasburian6550 2 ай бұрын
I have never seen this hook before and I just ran into it in my company's project. This video helped me a lot to get up to speed. Thanks!
@faraonch
@faraonch 9 ай бұрын
I should have watched this video BEFORE my last two nights! Well explained!
@artursavchuk2363
@artursavchuk2363 7 ай бұрын
omg, I have thought so many times about this functionality, and I was so disappointed that react can't do it. Thank you so much for this information, this is very useful 👍
@LobbanVlogs
@LobbanVlogs 20 күн бұрын
I was going crazy figuring out how to get this working with HTML Elements. Second part of this video was crucial for me since I wanted to get my types correct. I was mixing up the Parent and Child refs. Thanks Bredda!!!
@pauloviniciuscoral1128
@pauloviniciuscoral1128 8 ай бұрын
And this also helps with the Single responsibility principle. Great video.
@opencode1
@opencode1 6 ай бұрын
Really love this type of videos, basic css but big functinality explanation. thank you for your effort
@smokinjoe3000
@smokinjoe3000 9 ай бұрын
holy moly, this is such a great react hook! once again, you teach me something new every day
@jingyazeng5834
@jingyazeng5834 Ай бұрын
omg This is really helpful! THANK YOU!
@farhadkhoshnoodi7954
@farhadkhoshnoodi7954 2 ай бұрын
I saved this video... was awesome...
@pallavidas2648
@pallavidas2648 11 ай бұрын
Amazing.. you made it so simple to understand! Thank you.
@camilo5821
@camilo5821 4 ай бұрын
With context is so useful
@monterourena
@monterourena 11 ай бұрын
Thank you so much for sharing this incredibly useful hook! I wish I had known about it sooner. Your content is a masterpiece
@ytra1001
@ytra1001 11 ай бұрын
Thanks you make things look simple
@rohansachdeva627
@rohansachdeva627 3 ай бұрын
super clear man!
@clasesutnfrc8699
@clasesutnfrc8699 9 ай бұрын
02:38 Expose child's method to parent 03:34 Expose child's method to parent | useImperativeHandle
@ichigoplayss376
@ichigoplayss376 Жыл бұрын
Great video, I've been following your TikTok for a while and learned much from you. I just realized that I haven't subscribed yet. Keep up the good work
@cosdensolutions
@cosdensolutions Жыл бұрын
Thank you for the kind words!
@icoderdev
@icoderdev Жыл бұрын
Once in a life time ❤❤❤
@TausifShekh-j5x
@TausifShekh-j5x Жыл бұрын
Great content cosden
@PalladinGOLD
@PalladinGOLD 8 ай бұрын
Your videos are awesome. Thanks
@icoderdev
@icoderdev Жыл бұрын
Cosden ❤...was out for a while. Hope i didn't miss alot.😊
@TheHumanistX
@TheHumanistX Жыл бұрын
lol love the slide-in of the subscribe pitch ;)
@cosdensolutions
@cosdensolutions Жыл бұрын
☺️
@prashlovessamosa
@prashlovessamosa Жыл бұрын
Thanks for making this.
@lukasluftlaufer1093
@lukasluftlaufer1093 Жыл бұрын
Amazing. Thanks for the great explanation!
@ExtraTurtle
@ExtraTurtle 9 ай бұрын
If I put the entire "counter" state in the parent, it would make every child component re-render, even when It doesn't use that state does this also happen with useImperativeHandle? When you click the button that runs counterRef.current.reset() will it also re-render the entire parent component? or is this also used as React.memo of some sort?
@swdotdev
@swdotdev Жыл бұрын
Great content again! Thank you very much dude!
@elozinoovedhe
@elozinoovedhe Жыл бұрын
Well explained!!!
@hikki2566
@hikki2566 7 ай бұрын
Thanks!
@CodingEnjoyer
@CodingEnjoyer 3 ай бұрын
Impressive !!
@bismarckkaine2700
@bismarckkaine2700 Жыл бұрын
Great job homie
@a.murshed8136
@a.murshed8136 9 ай бұрын
Great tutorial as usual. I have a question here, what is the difference if the child function is defined with ForwardRef or without?
@prafullkumar6369
@prafullkumar6369 7 ай бұрын
Very nice video 👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏🤟🤟🤟🤟🤟 Love it. very use ful
@vasiapypochkin3241
@vasiapypochkin3241 8 ай бұрын
Привет, в setCount можно было передавать callback, аргумент которого является prevState. для гарантии того что count является актуальным значением. p.s. спасибо за видео :D
@Vishal360
@Vishal360 10 ай бұрын
Straight to damnn mind
@Vishal360
@Vishal360 10 ай бұрын
Subscribed 🤗
@badishammadache2922
@badishammadache2922 Жыл бұрын
great video
@JacksonDiKey
@JacksonDiKey Жыл бұрын
Cool stuff! Can u pls simply explaine how forwardRef working? it's a little bit tricky for use. Thnks!
@Txous77
@Txous77 Ай бұрын
If I understand correctly, this would be kind of the opposite to useContext (where you pass a piece of data from up to down without prop drilling)?
@MEZOMEZO2011
@MEZOMEZO2011 Жыл бұрын
I understood the concept but don't see how this will help in closed library components. Here you still needed to change the Counter component to be able to add the useImperative and accept the Ref as props. Or are you saying that the component in the library itself will have that set up by default?
@cosdensolutions
@cosdensolutions Жыл бұрын
Yeah that's exactly what I meant! I didn't form it properly 😅
@snatvb
@snatvb Жыл бұрын
it's not so good concept as you think and makes inverted control that usually leads to a lot of bugs better is to create context and provide state with api from that useImperativeHandle needs to extends api of video tag for example, for make adapters
@Shanksther3d
@Shanksther3d Жыл бұрын
Really enjoyed this video, very instructive 🙏🔥🔥 keep going. Ps: isSubrscribed(true) 😂👍
@cosdensolutions
@cosdensolutions Жыл бұрын
❤️
@emaaadelgado
@emaaadelgado 7 ай бұрын
is there any way to detect the changes on the child from the parent? using this way..
@nguyenvannhat5114
@nguyenvannhat5114 8 ай бұрын
Please help. My current in ref of parent always null.
@cordial
@cordial Жыл бұрын
Good explainer as ever. This seems rather anti-pattern, im not entirely sure in what instance it would be ok to use it.
@cosdensolutions
@cosdensolutions Жыл бұрын
Yeah I get the anti pattern vibes but there are a lot of use cases! Most 3rd party libraries do it and also if you make some component you need to trigger from above this is great
@goblinmoblin4869
@goblinmoblin4869 4 ай бұрын
I love you
@Ravi_Kaushik_Vlogs
@Ravi_Kaushik_Vlogs Жыл бұрын
please creata a video of usecallback and usememo and react.memo with child component
@cosdensolutions
@cosdensolutions Жыл бұрын
Already did ☺️
@saqibmuhammad7218
@saqibmuhammad7218 11 ай бұрын
what is meaning by cha-cha \
@HAROLDDELROSARIO-j5c
@HAROLDDELROSARIO-j5c Жыл бұрын
What if I pass the function as a property of the counter component? Is it better or not? Beginner nyehehe
@cosdensolutions
@cosdensolutions Жыл бұрын
I go over this in the video :D
@joshuasingh854
@joshuasingh854 Жыл бұрын
"This is counter-intuitive" - heh
@cosdensolutions
@cosdensolutions Жыл бұрын
hahahaha
@nikhiljadhav7666
@nikhiljadhav7666 Жыл бұрын
Speak slowly , You are speaking so fast cant change playback speed then it becomes very slow , speak slowly then you will get subscribe 😅
@icoderdev
@icoderdev Жыл бұрын
Once in a life time ❤❤❤
Learn React Hooks: useTransition - Simply Explained!
10:41
Cosden Solutions
Рет қаралды 29 М.
Learn React Hooks: useCallback - Simply Explained!
17:15
Cosden Solutions
Рет қаралды 105 М.
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 74 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 15 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 136 МЛН
Never Forget React forwardRef Again
9:33
Coding in Public
Рет қаралды 22 М.
Learn useImperativeHandle In 10 Minutes
9:34
Web Dev Simplified
Рет қаралды 69 М.
Learn React Hooks: useReducer - Simply Explained!
13:48
Cosden Solutions
Рет қаралды 67 М.
Senior Devs Use These React Hooks
7:05
Youssef Benlemlih
Рет қаралды 3,7 М.
React Hook useRef and forwarding refs with forwardRef
14:46
techsith
Рет қаралды 81 М.
Learn React Hooks: useMemo - Simply Explained!
13:41
Cosden Solutions
Рет қаралды 113 М.
Learn React Hooks: useLayoutEffect - Simply Explained!
9:17
Cosden Solutions
Рет қаралды 20 М.
Learn React Hooks: useDeferredValue - Simply Explained!
12:02
Cosden Solutions
Рет қаралды 16 М.
Learn React Hooks: useEffect - Simply Explained!
14:07
Cosden Solutions
Рет қаралды 167 М.
The correct way to optimise React
11:29
Cosden Solutions
Рет қаралды 36 М.
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 74 МЛН