React integration
useImperativeHandle
Customizes the handle exposed through a ref.
Formal Syntax & Structure
react syntaxreact
useImperativeHandle(ref, () => ({ focus() { input.current?.focus(); } }), [])Working Example
Example Snippetreact
useImperativeHandle(ref, () => ({ focus() { input.current?.focus(); } }), [])