Why use listeners and not just onChange
?
#1046
Unanswered
bennettdams
asked this question in
General
Replies: 1 comment
-
I feel listeners API is more useful in cases where we want to trigger event handlers of field based on other field's value change. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
I would like to know about the intended use case of the "listeners" API.
The docs talk about "Side effects for event triggers", where you can execute something of the field changes, e.g.
"Country" input changes, "Province" field is resetted
The example has a listener on the "Country" field:
But why not just execute this update in the
onChange
function (at the<input />
element) of the "Country" field? Something like:Is it just to have a cleaner separation of concerns or are the other benefits in using the "listener"?
Maybe the "listener" is executed after a succesful validation?
If so, I think it might be worth to add the difference between the two in the docs.
Beta Was this translation helpful? Give feedback.
All reactions