Skip to content

Recommended way to attach client-side callbacks? #1207

Answered by gbj
M1cha asked this question in Q&A
Discussion options

You must be logged in to vote

The server side of your app crate is already compiling wasm-bindgen as part of Leptos to support the ability to have ordinary on:click and so on and have the events typed properly via web-sys etc., so I don't think it would add any compile time at all to use it to generate a binding that you'll call in an event listener.

Changing the view macro so it doesn't use the value of the handler at all in SSR mode would generate "unused variable" warnings for all event listeners while running in SSR mode, which is surely not desirable.

It seems like there are a few different options here, and which one you want to use is a matter of personal preference, but there aren't really technical limitation…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@M1cha
Comment options

@gbj
Comment options

Answer selected by M1cha
@M1cha
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants