omnibar
omnibar copied to clipboard
Add option for forwarding ref to input element.
If I want to programatically .focus() the input element, I have to use findDOMNode which is deprecated and on the way out.
It would be really useful to expose an option to pass a ref so I could manipulate the input field.
For example, using a keyboard shortcut and mousetrap.
export default function Omnisearch () {
const inputRef = useRef(null)
const focusSearch = (e) => {
e.preventDefault()
inputRef.focus()
}
useMousetrap('/', focusSearch)
useMousetrap('s', focusSearch)
return (
<Omnibar
inputRef={inputRef}
/>
)
}