Closed mattmccray closed 7 years ago
@Evernight What do you mean, it ignores the mouse events? This is a strange case and you can write
onChange={function() {}}
to suppress the warning.
6 years late but essentially this!
<input
type="url"
value={value}
onChange={suppressMissingOnChangeHandlerWarning}
onBlur={e => onChange(e.currentTarget.value)}
/>
Works great!
In case it is unclear, suppressMissingOnChangeHandlerWarning
is just a function declared elsewhere so the prop is stable and sort of documented.
function suppressMissingOnChangeHandlerWarning() {}
When you create an input component and set its
value
without providing anonChange
handler, React will log this to the console:This isn't entirely accurate however. For example in my app I rely on event bubbling so that I can set a single
onChange
on the form component, therebysaving my sanitypreventing me from having to add anonChange
to every. single. field. (There are a lot in the app I'm working on)