Short, concise, no fluff, effective examples Where do we pay this guy
@sainathreddy1950 Жыл бұрын
There is an option super thanks just below the video. you can pay him using it.
@jingyazeng58342 ай бұрын
Clear explanation and super helpful use cases. THANK YOU!
@feynthefallen2 жыл бұрын
You know, I have used useImperativeHandle, I've used useRef, I've used forwardRef, but only because somebody told me "do it that way". I'd be mighty grateful if some day you posted a deep dive into Refs course that goes into the nitty-gritty of the concept of the humble ref and explains in detail what they are and how they are implemented. I found your video on the inner workings of Promises extremely helpful. Maybe you can do something similar for refs.
@utkarshagrawal36402 жыл бұрын
But don't u think there isn't much to refs, u already know the concept right?
@Bluesourboy2 жыл бұрын
I've always thought of useRef like a smart container that always contains the thing you put in it because in React objects and elements are recreated every render and you want to have a reference to the same thing even if it's recreated.
@Jaylaud11 ай бұрын
My favorite tech teacher. Always on point
@prasanths89603 ай бұрын
Thanks for your Awesome explanation..I understood it clearly.. support from India ❤
@alekdemj9 ай бұрын
I have watched many of your videos and I want to say you are great explainer!
@vadimc4128 Жыл бұрын
Great video! The alternative way to do that is pass an object containing all the refs as a single ref. It works for me
@shinmei9712 жыл бұрын
Very clear explanation, I might use this in my projects now, it's really useful !
@zorro1612 ай бұрын
bro thank you soo much you are the best the dots just connect when you were explian man thanks again man
@jellyfith Жыл бұрын
Chef's kiss. Well done! Appreciate the content
@ashish_prajapati_tr2 жыл бұрын
your videos are very helpful. i already have found a use case of this topic by watching your tutorial. thanks.
@Dan-p7f2 жыл бұрын
When I learn something new I'm always checking your videos about topics that I need. Thank you so much man!
@nishaindesilva37382 жыл бұрын
thanks! your tutorials really helps to understand about science in hooks in less cognitive overload
@ternomhwange1079 Жыл бұрын
Thanks for these well-explained lessons. God bless you
@daxdivv2 жыл бұрын
Next video: “Learn how to style your hair like Kyle”
@ajsyt2 жыл бұрын
ps. Using CSS
@sinc18022 жыл бұрын
@@ajsyt I think it's something with the pseudo elements and linear gradient
@discjockeydado2 жыл бұрын
He uses the useHairStyle hook
@adtc Жыл бұрын
It's Brylcreem
@rayanfadhlaoui4823 Жыл бұрын
Thank you ! Very good/clear explanation.
@AmanSingh-px5if2 жыл бұрын
Isn't then the usImperativeHandle just a wrapper around a useEffect which is modifying a ref? I could do the same thing by passing the ref value through the prop, and modifying it inside an useEffect in child component, any differences? or just syntactic sugar?
@sahej972 жыл бұрын
Ok, but then how would you accomplish the very last example of focusing different elements inside the child component jsx using your approach?
@SuperAsfath4 ай бұрын
Thanks for the amazing tutorial. I'm a non native English speaker, I watched this video with 0.75x speed. My suggestion is you may talk a bit slower, if somebody want, they can watch the video in higher speed.
@PickleRiiiiiiick Жыл бұрын
You're killing it man. Keep going.
@samandarboymurodov89412 жыл бұрын
Nice tutorial, thank you for sharing this!
@akinjidesleek Жыл бұрын
Yo I love this! Thanks Kyle.
@mhthepsycho5 ай бұрын
One question, you could make an object of these new references and do something like ref.current={focusButton:buttonRef.current.focus()}, what will be the problem in doing this/
@ArunKumar-bs1pg8 ай бұрын
Hi. Exact same coding I tried I am able to access those functions in my parent Component. But focus is not working what might be the reason.
@damagelooper3102 Жыл бұрын
Hi, two questions: 1) Can you only use React.forwardRef on an export default? and 2) Can you use useImperativeHandle with anything other than refs? Thank you!
@rahuls331 Жыл бұрын
Answer to your first question: Not necessarily. You can use forwardRef during the component declaration too. like below const App = React.forwardRef((props, ref) => { return 'hello' }) export default App. answer to your 2nd question: React docs mentions that the hook is used to customise the ref. I'm not sure what else you could do with it. What exactly are you trying to do?
@JustSkillGG Жыл бұрын
Very clear explanation. I have serious trouble though making useImperativeHandle to work with TypeScript
@nkululekomthimkulu12488 ай бұрын
Did you figure it out? I'll give it a try.
@igdev60952 жыл бұрын
What is the difference between useTransition and useDefferValue hooks? I’t quite same
@mxxo42392 жыл бұрын
Neat. But just to make sure I'm understanding the use-case: essentially useImperativeHandle (along with useRef) allow you to call functions that live on a child component? As opposed to the old way of passing down a function as a prop where the function has to live on the parent and passed into the child?
@awekeningbro12072 жыл бұрын
yup, you can basically use this hook to expose functions that live inside child component to the parent and directly call them from there.
@tuananhdo1870 Жыл бұрын
Life changing video!
@free2idol1 Жыл бұрын
At the end, you said that this hook should be used only in specific scenario. Can you give example of when not to use `useImperativeHandle`?
@NCS8331 Жыл бұрын
Superb ❤🎉
@battle2n2 жыл бұрын
9:09 woof
@bikashshrestha8402 жыл бұрын
wooo. i didn't know handling model was this easy.
@lichaytiram9246 Жыл бұрын
It nice but i big problem is not working with input form - register isndie element block it.
@DizzyDiz20063 ай бұрын
❤ these videos!
@jawadsrour84902 жыл бұрын
Awesome content!
@rodrigonovais9624 Жыл бұрын
How can I "complement" the ref instead of override it?
@ПетърТодоров-о7ф2 жыл бұрын
Clarified it, thanks
@StilesClover2 жыл бұрын
hey it's not about the video but I would like to hear your professional opinion on this. So the thing is I'm in a little sport anime online community and well I post now since 2 years news only for the sports genre on a google sites. It works well and all but with over 170 news or better said pages it's getting kinda annoying for me and well because it's a google sites it doesn't have a lot of features but it's working. So I'm thinking now for months that I would like to switch but the question is should I use a specific website builder or do it myself? I guess the most important thing is that I really need a CMS because this would make it soooo much easier for me. I already found a site that uses CMS and it was great but the amount of CMS pages which they offered (Even with paid prices) was really limited so if I want to add more besides the news (shows, characters etc.) I would run out of space really fast :/ So any suggestions what I should do? Do it myself (but I would need a great tutorial because besides some basics I don't know much) or use a website builder (and which?).
@davlasry2 жыл бұрын
I still don't understand what is wrong with doing it with props and what you mean when saying that that we will have to handle the focus state?
@Pilosofia2 жыл бұрын
so this hook is when you want to pass a function from child to parent component. I use to do this by using context. but will be helpfull in the small and presentational components.
@stem_school2 жыл бұрын
I'm interested in email validation for a new registered users, but it's not in your video list.
@pawekoaczynski45052 жыл бұрын
So basically, I can just grab a button with `.querySelector('.btn')`, and call the `.focus()` method, but that's not the React way to do it. So React provides use with the hook, to make the calls imperatively, kinda like in the vanilla JS. That's how I understand this
@luisbalza37742 жыл бұрын
That's EXACTLY what I thought when I learned about that hook
@justin_t Жыл бұрын
very nice!
@Pareshbpatel Жыл бұрын
The useImperativeHandle hook , clearly explained. Thanks Kyle {2023-11-09}
@talkohavy Жыл бұрын
Who gave you a dislike?? Stupid people on the internet... Anyway, great explanation bro! You're awesome! Love your content. Subscribed.
@umang22262 жыл бұрын
Thank you :)
@Emerald132 жыл бұрын
Thank you!
@EnsYlmaz515 ай бұрын
very good
@niZmosis2 жыл бұрын
That's bangin
@harshan49892 жыл бұрын
Nice 🎉
@chrismartinez57112 жыл бұрын
Not sure why, but for the second portion I had to wrap my modal ref function within onClick. Ex {modal.current.focus1()}} >Focus On input 1 It seemed like sometimes it would work without it, sometimes not, but going this route worked all the time.
@HASHlRAMA2 жыл бұрын
I still don't understand what is the purpose of the hook. Can you not just set the ref to an object containing the three functions inside a useEffect for instance?
@HASHlRAMA2 жыл бұрын
@@EverRusting Sure, but that's how refs work anyways. They use the property current to actually store the value. Which is what I meant to say when I suggested to modify the ref.
@sahej972 жыл бұрын
Have you tried that in a sandbox?
@lkffkl7276 Жыл бұрын
@@sahej97 i have, it works
@yigitruzgaruzun72892 жыл бұрын
Thanks
@zekumoru Жыл бұрын
The `useImperativeHandle` hook reminds me of the `useReducer` hook in a way that rather than having a dispatch function passed down to components, we pass the actions up the component with the `useImperativeHandle` hook. Needless to say, I am not saying that `useImperativeHandle` behaves exactly the opposite of `useReducer`.
@adtc Жыл бұрын
Yeah, with useReducer you can let children control state in the parent. With useImperativeHandle you can let the parent control some attribute of children without changing or using props.
@aarona31442 жыл бұрын
"Was this a good video explaining useImperativeHandle?" "I can neither confirm nor deny this." Sorry, I had to. lol
@Nyco3D Жыл бұрын
Hold onto your hats, folks! 🎩😄 Get ready to transform that basic functional component into a luxurious class cruise ship! 🚀⛵ the glamorous realm of class-like functional components! 💃 But hey, you can just, use a class component! 😜
@rabahalishah5124 Жыл бұрын
bro why didn't use forwardref in second example?
@shawnlee67752 жыл бұрын
All of that boilerplate when Svelte does that for free. Jeez.
@sahej972 жыл бұрын
I dont think it is advisable to use callbacks for the onClick event.
@mukulr5171 Жыл бұрын
🔥🔥
@medislamyah2 жыл бұрын
What i have to learn in JavaScript?
@KamalSingh-qe5oi Жыл бұрын
Goat
@wagiewojak2 жыл бұрын
Coming from vue, i see that i will never start with react if i dont need to. So much bloated up
@agsrf6479 Жыл бұрын
Bumbaclot
@malikeththeblackblade2675 Жыл бұрын
I decided to prepend if(open) to the three buttons so I wouldn't get an error if open===false
@adtc Жыл бұрын
We can just import forwardRef directly instead of importing React.
@yeahyeahduderooski2 жыл бұрын
Niiiice
@SohailKhan-tc8uz2 жыл бұрын
Bro create a fresh React JS full course
@ShelbyLuong Жыл бұрын
this is like Vuejs defineExpose, right everyone ?
@ZeusTheKid2 жыл бұрын
gangsta
@ricardorien Жыл бұрын
You should take the oportunity and insteand throw a stupid alert, just modify the value, or reset, or put a prefix. We are tired of basic tutorials for advance features like this one.
@akshaychavan55114 ай бұрын
Succinct!
@memeyardthoughts11972 жыл бұрын
Here’s another useful custom hook you can create in react to detect user activity. It’s called useActive hook. Check it out - kzbin.info/www/bejne/n5PGdIyCa7CZZ5Y
@blueblue94102 жыл бұрын
what the fuck is going on
@devfreemax35782 жыл бұрын
Kyle you're crack
@dpaulflavius2 жыл бұрын
learn how to use it and forgot right away 😁
@anasouardini Жыл бұрын
So, all of this so that you don't use an object inside of a Ref? After reading the docs, asking people on Discord and watching a video on KZbin, I still think it's an entirely useless hook. I just don't know why React team just like to confuse people!!