children.rs 728 B

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