Having an Input
from semantic-ui-react
changed when the User writes something, does fire onChange
and any parent component
that includes the Input
fires onChange
as well. A process called bubble
.... right?
Example
<li onChange={this.onListChange}>
<Input onChange={this.onInputChange}/>
</li>
Any change made in the Input
, fires onInputChange()
and onListChange()
together one after another.
Although, when Input.value/text/content
is changed dynamically, Input.onChange()
is not called at all. So you have to call the onChange()
function manually.
setFoo() {
this.input.value = 'foo';
this.inputChange();
}
But the problem here is, that when we call inputChange we don't get as e.target
the component Input
, nor data
has anything to do with it, and the most important ... :
No Bubbling effect.
Which means that onListChange()
will not be fired.
Question:
How can I achieve a proper bugless bubbled onChange()
on Semantic-UI-React?