children.rs 774 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //! Basic example that renders a simple VNode to the browser.
  2. use dioxus_core::prelude::*;
  3. use dioxus_html_namespace as dioxus_elements;
  4. use dioxus_web::*;
  5. fn main() {
  6. // Setup logging
  7. wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
  8. console_error_panic_hook::set_once();
  9. // Run the app
  10. wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
  11. }
  12. static App: FC<()> = |cx| {
  13. cx.render(rsx! {
  14. Calcier {
  15. h2 {"abc 1"}
  16. h2 {"abc 2"}
  17. h2 {"abc 3"}
  18. h2 {"abc 4"}
  19. h2 {"abc 5"}
  20. }
  21. })
  22. };
  23. static Calcier: FC<()> = |cx| {
  24. cx.render(rsx! {
  25. div {
  26. h1 {
  27. "abc 0"
  28. }
  29. {cx.children()}
  30. }
  31. })
  32. };