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
En esta página del sitio puede ver el video en línea useImperativeHandle | React Hooks Tutorial #12 de Duración hora minuto segunda en buena calidad , que subió el usuario Philip Fabianek 14 abril 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 6,218 veces y le gustó 187 a los espectadores. Disfruta viendo!