dioxus/examples/xss_safety.rs

26 lines
540 B
Rust
Raw Normal View History

//! XSS Safety
//!
//! This example proves that Dioxus is safe from XSS attacks.
use dioxus::prelude::*;
fn main() {
launch_desktop(app);
}
fn app() -> Element {
let mut contents = use_signal(|| String::from("<script>alert(\"hello world\")</script>"));
2024-01-16 19:18:46 +00:00
rsx! {
div {
h1 {"Dioxus is XSS-Safe"}
h3 { "{contents}" }
input {
value: "{contents}",
r#type: "text",
2023-09-01 20:38:55 +00:00
oninput: move |e| contents.set(e.value()),
}
}
2024-01-14 05:12:21 +00:00
}
}