simple_list.rs 649 B

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