useImperativeHandle | React Hooks Tutorial #12

Publicado em: 14 Abril 2021
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line useImperativeHandle | React Hooks Tutorial #12 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Philip Fabianek 14 Abril 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 6,218 vezes e gostou 187 espectadores. Boa visualização!