nested.rs 732 B

12345678910111213141516171819202122232425262728293031323334
  1. #![allow(unused)]
  2. //! Example of components in
  3. use std::borrow::Borrow;
  4. use dioxus_core::prelude::*;
  5. fn main() {}
  6. static Header: FC<()> = |ctx, props| {
  7. let inner = use_ref(&ctx, || 0);
  8. let handler1 = move || println!("Value is {}", inner.current());
  9. ctx.render(dioxus::prelude::LazyNodes::new(|c| {
  10. builder::ElementBuilder::new(c, "div")
  11. .child(VNode::Component(VComponent::new(
  12. Bottom,
  13. //
  14. c.bump.alloc(()),
  15. None,
  16. )))
  17. .finish()
  18. }))
  19. };
  20. static Bottom: FC<()> = |ctx, props| {
  21. ctx.render(html! {
  22. <div>
  23. <h1> "bruh 1" </h1>
  24. <h1> "bruh 2" </h1>
  25. </div>
  26. })
  27. };