dioxus/packages/core/examples/hooks.rs
2021-12-14 21:46:19 -05:00

16 lines
384 B
Rust

use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_hooks::use_state;
use dioxus_html as dioxus_elements;
fn main() {}
fn App(cx: Scope<()>) -> Element {
let color = use_state(&cx, || "white");
cx.render(rsx!(
div { onclick: move |_| color.set("red"), "red" }
div { onclick: move |_| color.set("blue"), "blue" }
))
}