ReactJS Tutorial - 28 - Refs

  Рет қаралды 344,166

Codevolution

Codevolution

Күн бұрын

Пікірлер
@vigneshgvs
@vigneshgvs 2 жыл бұрын
Refs To Input element: Ref - to make autofocus Steps: 1. Create ref - using React.creatRef() and assign it class variable - reference variable 2. attach to input element using “ref” attribute What above step does: makes the input element = ‘current’ property, in the class variable. 3. call focus() method on input element. - using the current property Types/ways: 1. React.createRef - uses “current” property - above 2. callback Ref - without “current” - below callback Ref: Steps: 1. create a property with null 2. on function click, call setter of that property and assign the ‘element’ 3. call focus method - directly from reference variable
@iUmerFarooq
@iUmerFarooq 4 жыл бұрын
You're the best teacher. Thank you for your great content and waiting for *NodeJs* Course.
@lollilolli4582
@lollilolli4582 3 жыл бұрын
I will recommend your course to whoever wants to learn React!"! A lot of thank you!
@anshulsinghla998
@anshulsinghla998 4 жыл бұрын
Omg, I can literally pay any amount for such quality content. I hope you could do a series where you build a complete project using ReactJS + NodeJs.
@pashish12345
@pashish12345 2 жыл бұрын
Very articulate , I have never seen such profound elaboration . Thanks a lot for such valuable content .
@allansarion7118
@allansarion7118 4 жыл бұрын
I like your videos because you provide summary at the end.
@tuatkiep9702
@tuatkiep9702 Жыл бұрын
You're the best teacher. Thank you for your great content
@Hermioneswand1
@Hermioneswand1 4 жыл бұрын
You are an amazing teacher, thank you so much!! 🙏
@marcofriso5922
@marcofriso5922 4 жыл бұрын
best explanation of React Ref that I found
@milosleng1175
@milosleng1175 3 жыл бұрын
i find this guide quite confusing, i am a beginner and I stopped watching at this point
@prisinha
@prisinha 2 жыл бұрын
2:05 second step is to attach ref to input element in render method
@tejaswir9018
@tejaswir9018 2 жыл бұрын
Thanks!
@minthep2611
@minthep2611 4 ай бұрын
Using React.createRef Create ref: Use React.createRef(), assign to variable in component. Attach to input: Use ref property on input. Call focus(): Access input via current of ref, call focus(). Using Callback Ref Create property: Create property, initialize to null. Assign callback: In input's ref, pass callback function. Call focus(): In callback, save input to property, call focus() on it.
@rajeevbhosle1580
@rajeevbhosle1580 3 жыл бұрын
you are blessing to the all programmer
@prisinha
@prisinha 2 жыл бұрын
1:33 first step is to create ref
@lightninginmyhands4878
@lightninginmyhands4878 3 жыл бұрын
I looked up Vishwas and went into a Bollywood rabbit hole. Cheers
@prisinha
@prisinha 2 жыл бұрын
0:05 Refs help to access DOM nodes directly
@RomanH91
@RomanH91 3 жыл бұрын
Why when I do ? console.log(this.inputRef) I can see the information about object console.log(this.cbRef) I can't see the information about object
@yewteebell
@yewteebell 3 жыл бұрын
Why export was removed at 1:04?
@vigneshtamizh4091
@vigneshtamizh4091 5 жыл бұрын
functionality is working fine with adding the callback function outside of constructor......Is there any reason to add the callback function inside of constructor ?
@subhashisz
@subhashisz 3 жыл бұрын
When class was loaded then constructor getting loaded by default, may be that was the reason.
@mohamedboukhanouf
@mohamedboukhanouf 3 жыл бұрын
Thank you codevolution👏
@naireetyaneema7131
@naireetyaneema7131 3 жыл бұрын
Can someone explain to me that we can use the autoFocus attribute in the input tag to create a focus on the field? So why use Ref??
@jreema
@jreema 4 жыл бұрын
We can use autoFocus property on the element right? Why do we need Refs?
@motnahp008
@motnahp008 3 жыл бұрын
I'm with you J Reema. This is a lot easier: than using multiple lines of code with React.
@saikumar2385
@saikumar2385 11 ай бұрын
I have a doubt, How is the this.cbRef in the IF function not null, when it's initialised to null?
@lathagm666
@lathagm666 Жыл бұрын
completed video 28. Thank you :-)
@beneasmare8867
@beneasmare8867 2 жыл бұрын
the tutorials are very interesting and the way of expiration looks like what the instructor is amazing, thank you a lot sir. please send the document that helps me as I am a beginner
@madhavilathaannamraju3656
@madhavilathaannamraju3656 3 жыл бұрын
this.inputRef.current.focus() didn't work. I had the .js same as the example component. It still doesn't seem to work. I'm using React 16.7 version
@yt-1161
@yt-1161 Жыл бұрын
is there function-based component version of this example ?
@MaheshKumar-qx8dy
@MaheshKumar-qx8dy 4 жыл бұрын
Great job, please keep doing Thank you very much 😊
@prisinha
@prisinha 2 жыл бұрын
4:00 how to fetch input value using ref
@NiKNjPaTeL
@NiKNjPaTeL 4 жыл бұрын
Question: can we attach ref to multiple elements? Will it give an error? If it will not give an error then what will be the output?
@shubhamasija6338
@shubhamasija6338 2 жыл бұрын
You can attach
@PROTECHRAHUL
@PROTECHRAHUL 2 жыл бұрын
Is ref used for input tags only
@anjalimurali5619
@anjalimurali5619 3 жыл бұрын
I have a dbt I have created the above classes and I put a console statement in every classes. But it is printing the console statement within withCounter class as first statemnt. Next showing the cosole in app js. Why this? Actually the first console. Should be in the app js right? So why the control initially goes to the withCounter js? Can somebody answer this?
@LearnphpPhpforbeginners
@LearnphpPhpforbeginners 3 жыл бұрын
Nice. I have a question please answer this how we will perform click event handling without using onClick. mean i have to use this by ID or class like jquery
@yateshchhabra9237
@yateshchhabra9237 3 жыл бұрын
How can we access the value of input tag using callback ref mechanism
@jokeropbro9867
@jokeropbro9867 2 жыл бұрын
Thankyou for such a great playlist 💝❤
@musazahoor
@musazahoor 8 ай бұрын
why my componentDidMount method is executing twice?
@coolmind2476
@coolmind2476 8 ай бұрын
Is it possible to use useRef hook as well?
@mareboinaravi5272
@mareboinaravi5272 3 жыл бұрын
2:52 --- componentDidMount life cycle hook what is that mean ??? anyone
@beverlyHillsAgent
@beverlyHillsAgent 3 жыл бұрын
What does the code compile even though you don't have semicolon on each line of your code?
@amlanmishra6273
@amlanmishra6273 3 жыл бұрын
it is optional in javascipt to use semicolon
@prisinha
@prisinha 2 жыл бұрын
2:32 third step is to call focus method on this input element
@uttamakarapu7715
@uttamakarapu7715 4 жыл бұрын
Vishwas, what takes precedence if we use refs and implement click funcionality and also use Onclick on the same button ?
@AjithKumar-sh1jx
@AjithKumar-sh1jx 5 жыл бұрын
Let the property cbSet return null during the unmounting Phase. The componentDidMount won't be called at the unmounting phase anyway. Why we need that check then?
@LeandroLuccerini
@LeandroLuccerini 4 жыл бұрын
Same question...
@matteol1778
@matteol1778 3 жыл бұрын
Awesome tutorial. GG man!
@ינוןאלבז-כ1ז
@ינוןאלבז-כ1ז 4 жыл бұрын
Wow its amazing explanation and very valuable content!!! Thanks a lot
@inkweonkim6299
@inkweonkim6299 4 жыл бұрын
Thanks, This Video Great! I have a question. When I click button, how to get input.value in "this.setCbRef"???
@keepanopenmindlookatallthe2540
@keepanopenmindlookatallthe2540 3 жыл бұрын
Is this available on functional components?
@humasayyed213
@humasayyed213 2 жыл бұрын
Really very useful. Thank you Sir..
@rupeshmalhotra7695
@rupeshmalhotra7695 4 жыл бұрын
hi there, can we use ONCHANGE or any method on input while using refs?
@flashfs
@flashfs 4 жыл бұрын
I do think so
@sonakshimishra.821
@sonakshimishra.821 3 жыл бұрын
There is no use of inputRef in callback ref approach, I guess.?
@sqwale7
@sqwale7 5 жыл бұрын
Why are you decalring "setCbRef" in the constructor ? You could make it an ordinary method ? Is this good practice ?
@PrakashBesra
@PrakashBesra 3 жыл бұрын
useRef in react hooks.
@VishalSharma-rn7mt
@VishalSharma-rn7mt 3 жыл бұрын
Great explanation
@venkateshjonnakuti
@venkateshjonnakuti 4 жыл бұрын
His sir may i know the shortcout code to write classcomponent. How to setup that(RFCE) from key board. Instead of writing everytime
@naveen3046
@naveen3046 4 жыл бұрын
you need to install "simple react snippets" extension in visual studio then only you can use those shortcuts
@arunlabana5937
@arunlabana5937 3 жыл бұрын
ES7 extensions from VS code extensions.
@jayveeramone
@jayveeramone 3 жыл бұрын
just curious, what's the difference of using createref() and just using autoFocus attribute?
@tonmoyhussain6132
@tonmoyhussain6132 Жыл бұрын
You can do lot more with ref. As you can access all the input property
@rohitsahu1443
@rohitsahu1443 3 жыл бұрын
wonderful explaination Thanks alot
@johannesalmroth8553
@johannesalmroth8553 4 жыл бұрын
Great tutorial! 👍
@codezoom8637
@codezoom8637 3 жыл бұрын
thanks for good way to illustrate this concept !
@Aditya.Santra
@Aditya.Santra 3 жыл бұрын
Very Helpful Video
@mukulsharma7540
@mukulsharma7540 2 жыл бұрын
This looks WRONG to me, where are we creating ref for this.cbRef? Like we did for this.inputRef = React.createRef?
@kirankamath5891
@kirankamath5891 2 жыл бұрын
indside the callbackRef function , we are attaching ref with event
@AAKSHAS
@AAKSHAS 3 жыл бұрын
8:28 Summary
@namoan1216
@namoan1216 4 жыл бұрын
what snippet you are using?
@naveen3046
@naveen3046 4 жыл бұрын
Simple React snippet
@oleksandrsydorenko3303
@oleksandrsydorenko3303 4 жыл бұрын
Tnx, man! Awesome explanation
@TusharBorawake
@TusharBorawake 4 жыл бұрын
Hi, Can you please make video in which parent component can have access it's child component and grandchild component methods using refs. I was stuck in my real time project. Using react hooks and class component.
@iUmerFarooq
@iUmerFarooq 4 жыл бұрын
Are you found that problem?
@phantazzor
@phantazzor 3 жыл бұрын
the same with hooks would be really appreciated !
@helinchooi6741
@helinchooi6741 4 жыл бұрын
I love your video man! Liked! One small thing is this video will be better if you teach the pros and cons between these 2 methods, or just tell us there are the same if nothing different expect the date that the feature added in the library.
@perumallayaswanth83
@perumallayaswanth83 4 жыл бұрын
Can I get ur code for each topic which you taught...any GitHub reference please..
@varunjindal1520
@varunjindal1520 4 жыл бұрын
Try to practice it yourself. Just seeing will help less. :)
@banti000
@banti000 5 жыл бұрын
just wondering what will happen if two elements are set to be focused , how will be it handled??
@bambino3624
@bambino3624 5 жыл бұрын
You can't put focus on more than one element. The last focus will overwrite the first one.
@kadirramazn
@kadirramazn 3 жыл бұрын
You really helped me a lot. Thank you
@prisinha
@prisinha 2 жыл бұрын
5:15 callback refs
@ulugbekdavronov1451
@ulugbekdavronov1451 2 жыл бұрын
thanks for good video
@AkashGupta-qc8rt
@AkashGupta-qc8rt 6 жыл бұрын
Hey bro please make one project on react js ... How to fetch data from api please
@sarunmaharjan4440
@sarunmaharjan4440 5 жыл бұрын
fetch("api_url_here") .then(response => response.json()) .then(json => { // do whatever you want with the json received console.log(json) }
@cristomathew9146
@cristomathew9146 4 жыл бұрын
Try JustDjango tutorials
@ai.201
@ai.201 4 жыл бұрын
Thanks
@yathrebamarneh3857
@yathrebamarneh3857 4 жыл бұрын
Thank you too much
@vaskogood1580
@vaskogood1580 4 жыл бұрын
before start, turn on speed on 1.25 , hf
@milosleng1175
@milosleng1175 3 жыл бұрын
he lost me even at 1.00 speed lol
@narendrareddyyarramreddy2007
@narendrareddyyarramreddy2007 2 жыл бұрын
I'm watching every video at 1.5x
@augittec8562
@augittec8562 2 жыл бұрын
first give concept life cycle methods i have no information about life cycle how i can understand
@Codevolution
@Codevolution 2 жыл бұрын
You probably skipped the videos :)
@arijitparia211
@arijitparia211 9 ай бұрын
just pass autofocus
@LearnphpPhpforbeginners
@LearnphpPhpforbeginners 3 жыл бұрын
Hi please answer my below comment. i am waiting
@subhamkrnavneet7110
@subhamkrnavneet7110 4 жыл бұрын
bhai you don't deliver the concept
@ikebelida1528
@ikebelida1528 Жыл бұрын
this. bla bla bla but i keep rewinding the vid of what the difference of the two but still cant under stand haha dang
@tempaltename8111
@tempaltename8111 Жыл бұрын
Why you are using . Everytime
@Pareshbpatel
@Pareshbpatel 9 ай бұрын
{2024-03-22}
@hamzaakbar5321
@hamzaakbar5321 Жыл бұрын
You are an amazing teacher, thank you so much!!
ReactJS Tutorial - 29 - Refs with Class Components
5:41
Codevolution
Рет қаралды 213 М.
Never Forget React forwardRef Again
9:33
Coding in Public
Рет қаралды 23 М.
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 493 М.
The Most Important Design Pattern in React
35:04
Cosden Solutions
Рет қаралды 115 М.
ReactJS Tutorial - 30 - Forwarding Refs
7:27
Codevolution
Рет қаралды 258 М.
useRef hook in reactjs | Easiest way
19:44
Hitesh Choudhary
Рет қаралды 83 М.
Speed Up Your React Apps With Code Splitting
16:50
Web Dev Simplified
Рет қаралды 396 М.
ReactJS Tutorial - 32 - Error Boundary
10:53
Codevolution
Рет қаралды 271 М.
ReactJS Tutorial - 31 - Portals
9:19
Codevolution
Рет қаралды 249 М.
10 React Hooks Explained // Plus Build your own from Scratch
13:15
Fireship
Рет қаралды 1,4 МЛН
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН