Whats up everybody? Thanks for watching! If you enjoyed the video, please be sure to drop a like it really helps. Also, if you have not already done so, be sure to subscribe to the channel so you never miss an upload. You can subscribe here: ruclips.net/user/codingwithchaim
I'm not sure what it is about these videos, but you are providing the kind of learning I've been looking for with React. I can look at tutorials all day and nothing sinks in, almost like the teacher is trying to save me from the difficult parts, but I walk away never actually knowing how the hell anything actually works. Far out man, thank you. Well done. I looks forward to more of these. In the meantime, I've got a bit of a back-catalogue of yours that I need to work through. :-)
I never really understood useRef, though I have used it a few times. This is the best explanation of what it does. Thank you very much for this awesome explanation!
brilliant. you're explaining everything in such good detail. and because i've been coding for a year i understand it. i'm switchign for game development to dev
I am so lucky to find your videos! I don't think i am smart But u really make me understand almost everything you said! You are such an amazing teacher! Keep it up the good work. You have no idea potentially how many lives You are saving ❤
I'm still kind of new to react and I only get to work on my project in my free time, so I need all the help I can get: I have a problem with useRef() that is driving me insane. I slapped a click listener onto a bunch of GenericComponent swhich attaches a "wraparound" Component to the click component. What I want to happen is: before click: after click: In my useEffect() hook, I try to access the currently clicked Wraparound- and GenericComponent, but it does not seem to catch up. Aftter my first click, the ref will be undefined. After my second click, the console output will be the first clicked element. I feel like I am not getting a crucial part about how useEffect() works here.. Any help is greatly apprecianted.
Thanks for this video by the way really needed, but so when you had "const time = useRef(Date.now())" and left the "ref={inputRef}" in the "input" tag, it still worked???
I want to desttructure html on that useref coz i want to use the get element by tag name. I have multple 50s input type text dynamically created by map function.
Thanks you! Awesome video explaining refs. But why don't you simply use this: useEffect(() => { const time = Date.now(); setInterval(() => { if (moment.diff(time, "minutes") > 1) { alert("you have ...") } }, 1000 * 60); }, []) Isn't it simpler and better? I don't get it why someone would prefer react refs approach over this.
This is a great question! I think maybe my example was a little lacking. The ref would be the better choice if you want access to the value in more than one place within the component. In your case it would be scoped to only within the useEffect
Yea that absolutely can work, but the idea is that sometimes you want to set focus to an input programmatically based on some conditions. Also, the idea of the example is more about showing that in react you need refs when you want interact with the actual dom.
Whats up everybody? Thanks for watching! If you enjoyed the video, please be sure to drop a like it really helps. Also, if you have not already done so, be sure to subscribe to the channel so you never miss an upload. You can subscribe here: ruclips.net/user/codingwithchaim
I'm not sure what it is about these videos, but you are providing the kind of learning I've been looking for with React. I can look at tutorials all day and nothing sinks in, almost like the teacher is trying to save me from the difficult parts, but I walk away never actually knowing how the hell anything actually works. Far out man, thank you. Well done. I looks forward to more of these. In the meantime, I've got a bit of a back-catalogue of yours that I need to work through. :-)
The best explanation of Refs I could find on RUclips. Thanks.
I never really understood useRef, though I have used it a few times. This is the best explanation of what it does. Thank you very much for this awesome explanation!
Thank you!!
Thanks a lot for explaining this concept very well, I loved you way you teach
You're the coolest React mentor out there! Thank You. And so underrated!
brilliant. you're explaining everything in such good detail. and because i've been coding for a year i understand it. i'm switchign for game development to dev
I am so lucky to find your videos! I don't think i am smart But u really make me understand almost everything you said! You are such an amazing teacher! Keep it up the good work. You have no idea potentially how many lives You are saving ❤
Good tutorial. Instead of using useRef for focus.. you could simply use autofocus attribute on input text JSX element for this first example.
Keep it up bro really helpful !!! Headsup from India !!!!
Excellent explanation, solid and detailed! really appreciated
Very helpful! Thanks!
Thanks for the quality content Chaim!
You got a lot of potential with this channel, just wanna say keep it up -- you have earned a sub. Cheers from Bangladesh
Thank you! I appreciate that
I'm still kind of new to react and I only get to work on my project in my free time, so I need all the help I can get: I have a problem with useRef() that is driving me insane.
I slapped a click listener onto a bunch of GenericComponent swhich attaches a "wraparound" Component to the click component. What I want to happen is:
before click:
after click:
In my useEffect() hook, I try to access the currently clicked Wraparound- and GenericComponent, but it does not seem to catch up. Aftter my first click, the ref will be undefined. After my second click, the console output will be the first clicked element. I feel like I am not getting a crucial part about how useEffect() works here.. Any help is greatly apprecianted.
Thanks for this video by the way really needed, but so when you had "const time = useRef(Date.now())" and left the "ref={inputRef}" in the "input" tag, it still worked???
Great video man. Thank you!
You are most welcome
awesome explanation god bless you
Brilliant videos. Don't unserstand why not so many subscr. People ! hit the button to subscribe ! Thank you man!
I want to desttructure html on that useref coz i want to use the get element by tag name. I have multple 50s input type text dynamically created by map function.
Thanks you! Awesome video explaining refs. But why don't you simply use this:
useEffect(() => {
const time = Date.now();
setInterval(() => {
if (moment.diff(time, "minutes") > 1) {
alert("you have ...")
}
}, 1000 * 60);
}, [])
Isn't it simpler and better? I don't get it why someone would prefer react refs approach over this.
This is a great question! I think maybe my example was a little lacking. The ref would be the better choice if you want access to the value in more than one place within the component. In your case it would be scoped to only within the useEffect
nice video
Why not for the focus?
Yea that absolutely can work, but the idea is that sometimes you want to set focus to an input programmatically based on some conditions. Also, the idea of the example is more about showing that in react you need refs when you want interact with the actual dom.
Great video, only request is to please go slow. You are very fast :)
I used a Ref to keep an Interval, because I didn't want multiple interval !
indeed! very good point
Can you change the value of a ref?
Rich Werden yes absolutely refs are completely mutable
does this cover ref forwarding?
No I didn’t include that in the video
FeathersJS Please
Great video! love from israel
Thank you! I miss Israel
Why did u keep ur face as if it’s rocket science? 😂 it’s not