added variables

This commit is contained in:
2024-12-02 22:59:25 +01:00
parent 36744b9b3e
commit 21cd343eaa
4 changed files with 30 additions and 3 deletions
+9 -2
View File
@@ -4,11 +4,18 @@ pub fn examples() -> Element {
rsx! {
styling: Some(styling()),
button { class: "btn", on_click: fn(_, _, document) {
document.exit();
button { class: "btn", on_click: fn(btn: &mut Button, _, document) {
let count = document.use_state::<u32>("count");
*count += 1;
btn.children.set_text(&count.to_string());
if *count == 10 {
document.exit();
}
}, "Click me!" }
text { "Welcome!" }
@count: i32;
}
}