simple_list.rs 775 B

123456789101112131415161718192021222324252627282930
  1. use dioxus::prelude::*;
  2. fn main() {
  3. dioxus_desktop::launch(app);
  4. }
  5. fn app(cx: Scope) -> Element {
  6. cx.render(rsx!(
  7. div { id: "123123123",
  8. // Use Map directly to lazily pull elements
  9. (0..10).map(|f| rsx! { "{f}" }),
  10. // Collect into an intermediate collection if necessary, and call into_iter
  11. ["a", "b", "c", "d", "e", "f"]
  12. .into_iter()
  13. .map(|f| rsx! { "{f}" })
  14. .collect::<Vec<_>>()
  15. .into_iter(),
  16. ["x", "y", "z"]
  17. .into_iter()
  18. .map(|f| rsx! { "{f}" })
  19. .collect::<Vec<_>>()
  20. .into_iter(),
  21. // Use optionals
  22. Some(rsx! { "Some" }),
  23. }
  24. ))
  25. }