Select the best answer.
React.useImperativeHandle(ref, () => ({ focus: () => inputRef.current && inputRef.current.focus() }));