Dernière activité 1729152893

Dioxus-5.rs Brut
1fn Counters() -> Element {
2 let mut counters = use_signal(|| vec![0; 10]);
3
4 rsx! {
5 button { onclick: move |_| counters.push(counters.len()), "Add Counter" }
6 ul {
7 for idx in 0..counters.len() {
8 li {
9 button { onclick: move |_| counters.write()[idx] += 1, "{counters.index(idx)}" }
10 button { onclick: move |_| { counters.remove(idx); }, "Remove" }
11 }
12 }
13 }
14 }
15}