Components participate in event handlers

This commit is contained in:
Jonathan Kelley committed 2024-01-11 12:11:27 -08:00
1 parent 8881b8a473
commit 1527b81e02
12 files changed
+86 -54

No files matched your search

+3 -1
View File
@@ -35,11 +35,13 @@ fn main() {
dioxus_desktop::launch_cfg(app, cfg);
}
const STYLE: &str = include_str!("./assets/calculator.css");
fn app(cx: Scope) -> Element {
let state = use_ref(cx, Calculator::new);
cx.render(rsx! {
style { {include_str!("./assets/calculator.css")} }
style { {STYLE} }
div { id: "wrapper",
div { class: "app",
div { class: "calculator", onkeypress: move |evt| state.write().handle_keydown(evt),