main/
main.rs

1use active_dom::{create_signal, mount, DOM};
2
3fn main() {
4    mount(|ctx| {
5        let count = create_signal(ctx, 1);
6
7        DOM::new("div")
8            .child(
9                &DOM::new("button")
10                    .text("-")
11                    .on("click", move |_| count.set(count.get() - 1))
12            )
13            .dyn_text(ctx, move || count.get().to_string())
14            .child(
15                &DOM::new("button")
16                .text("+")
17                .on("click", move |_| count.set(count.get() + 1))
18            )
19    });
20}