Closed jkleiser closed 4 years ago
You can pass e to the event handler:
<form onsubmit={e => app.run("@get-host-games", state.host, e)}>
......
</form>
and then cancel it:
"#Remote": (state, token, e) => {
e.preventDefault();
......
}
This is probably what you had in mind:
<form onsubmit={e => { e.preventDefault(); app.run("@get-host-games", state.host); }}>
It does what I wanted.
The added e
in "#Remote": (state, token, e) => {
seems always to be undefined
.
Thanks.
In the "Remote" component in my new SPA I have this form:
In the
update
list I also have this event handler:When I enter something in the form's input and click the button, I see in the console that the "#Remote" event handler is also being called. The effect is that
app.run("@get-host-games", state.host)
is executed twice. It is not a big problem, but can I avoid the automatic call to the "#Remote" event handler in this situation?Is it my use of
onsubmit
that triggers the "#Remote" event handler?