feat: integrate fermi

This commit is contained in:
Jonathan Kelley committed 2022-02-17 10:38:51 -05:00
1 parent 3873cd1a60
commit d461ffc011
23 files changed
+630 -15

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#![allow(non_snake_case)]
use dioxus::prelude::*;
use fermi::prelude::*;
fn main() {
dioxus::desktop::launch(app)
}
static NAME: Atom<String> = |_| "world".to_string();
fn app(cx: Scope) -> Element {
let name = use_read(&cx, NAME);
cx.render(rsx! {
div { "hello {name}!" }
Child {}
})
}
fn Child(cx: Scope) -> Element {
let set_name = use_set(&cx, NAME);
cx.render(rsx! {
button {
onclick: move |_| set_name("dioxus".to_string()),
"reset name"
}
})
}