dioxus/docs/main-concepts/04-hooks.md
2021-07-18 12:39:32 -04:00

430 B

fn Example(cx: &mut Context<()>) -> DomTree {
    let service = use_combubulator(cx);
    let Status { name, pending, count } = service.info();
    html! {
        <div>
            <p> "Hello, {name}!" </p>
            <p> "Status: {pending}!" </p>
            <p> "Count {count}!" </p>
            <button onclick=|_| service.update()>
                "Refresh services"
            </button>
        </div>
    }
}