Files
dioxus/docs/guide/src/en/__unused/event_javascript.rs
T
Marco Godoy 9538cfe733 Update Docs CI with mdbook translation support (#516)
* Update Docs CI with mdbook translation support #514

* install mdbook with --rev
2022-08-04 10:26:04 -05:00

27 lines
526 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## JavaScript Handlers
Instead of passing a closure, you can also pass a string to event handlers – this lets you use JavaScript (if your renderer can execute JavaScript):
```rust
{{#include ../../../examples/event_javascript.rs:rsx}}
```
#![allow(non_snake_case)]
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(App);
}
fn App(cx: Scope) -> Element {
cx.render(rsx! {
// ANCHOR: rsx
div {
onclick: "alert('hello world')",
}
// ANCHOR_END: rsx
})
}