If I want a single onChange event handler for multiple TextField components, I am unable to determine which component triggered the event since the only argument is the value
This creates a black box that requires the developer to create multiple handlers or bound handlers to determine trivial info about the event. Also, this prevents the developer from using event.preventDefault(). Furthermore, it does not make a distinction between onInput and onChange which are fundamentally unique and mutually exclusive.
This is funny.
They added onChanged to get only the values when it changes (onChange/onInput don't work), but if you put onKeyUp you can register the event.
I mean, Why did they bind the onKeyUp event to the input but no the onChange/onInput?
It just doesn't make sense. I kind guess that is happening to resolve the onChanged event but it would be ok if that event sends the event too.
Yeah, not great! This should be fixed as soon as possible.
Recommendations;
Add onChange(ev: HTMLInputEvent, value: val), which lets you handle ev, and provides the current value if you want it.
Mark onChanged as deprecated. Keep it backwards compatible to avoid breaking partners.
Most helpful comment
Yeah, not great! This should be fixed as soon as possible.
Recommendations;
Add
onChange(ev: HTMLInputEvent, value: val), which lets you handle ev, and provides the current value if you want it.Mark
onChangedas deprecated. Keep it backwards compatible to avoid breaking partners.