dioxus/docs/posts/04-hooks.md
2021-02-08 11:12:02 -05:00

435 B

fn Example(ctx: &mut Context<()>) -> VNode {
    let service = use_combubulator(ctx);
    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> 
    }
}