useImperativeHandle | React Hooks Tutorial #12

Publié le: 14 avril 2021
sur la chaîne: Philip Fabianek
6,218
187

In this final episode of my React Hooks Tutorial, we will learn about the useImperativeHandle hook. In order to understand the useImperativeHandle hook, we first have to understand the concept of forwarding refs using the React.forwardRef function. This allows us to pass refs to nested components, because we cannot achieve so using the ref keyword. After that, we will make use of the useImperativeHandle hook inside an input to modify the forwarded ref by exposing a custom focusAndBlur property. The useImperativeHandle hook will allow us to call that method from the parent component using a button.

Starting repository:

https://github.com/philipfabianek/rea...

Ending repository:

https://github.com/philipfabianek/rea...

Timestamps:

►0:00 Introduction
►0:26 Explaining forwaring refs
►1:09 Explaining the useImperativeHandle hook
►1:44 Creating input and the parent ref
►2:23 Forwarding the parent ref
►3:38 Implementing the useImperativeHandle hook
►5:10 Creating a button to call focusAndBlur on click
►5:45 Ending

Social Media:

►Twitter:   / philip_fabianek  
►LinkedIn:   / philip-fabianek  
►Website: http://www.philipfabianek.com
►GitHub: https://github.com/philipfabianek


Sur cette page du site, vous pouvez voir la vidéo en ligne useImperativeHandle | React Hooks Tutorial #12 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Philip Fabianek 14 avril 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 6,218 fois et il a aimé 187 téléspectateurs. Bon visionnage!