Skip to content

Latest commit

 

History

History
19 lines (11 loc) · 832 Bytes

useImperativeHandle.md

File metadata and controls

19 lines (11 loc) · 832 Bytes

useImperativeHandle hook

useImperativeHandle customizes the instance value that is exposed to parent components when using ref

Notes:

  • It's mostly used in combination with React.forwardRef
  • It's a way to mimic the ref prop in class components (see this reply for more information).

Example

Another example

You might want to customize the measureInWindow property of an input to measure a wrapper around it instead of the input field itself.