Skip to main content

The Input component is missing onFocus & onBlur handlers, which are pretty useful for e.g. form validation. At the moment the only way around it it is to use refs which gets pretty messy.

Current doing this:


...
useEffect(() => {
if (inputRef && inputRef.current) {
inputRef.current.onblur = console.log;
}
}, [inputRef]);

return (
<Input
ref={inputRef}
value={value}
onChange={handleChange}
/>
)

When I’d love to do this:


return (
<Input
onBlur={console.log}
value={value}
onChange={handleChange}
/>
Be the first to reply!

Reply