pub fn mount(cb: impl FnOnce(&'static Runtime) -> DOM)Expand description
Mount
Mount to html body.
Examples found in repository?
examples/main.rs (lines 4-19)
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}