nested.rs 674 B

123456789101112131415161718192021222324252627282930313233
  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(|bump| {
  10. builder::ElementBuilder::new(bump, "div")
  11. .child(VNode::Component(VComponent::new(
  12. Bottom,
  13. //
  14. &mut (),
  15. )))
  16. .finish()
  17. })
  18. };
  19. static Bottom: FC<()> = |ctx, props| {
  20. ctx.render(html! {
  21. <div>
  22. <h1> "bruh 1" </h1>
  23. <h1> "bruh 2" </h1>
  24. </div>
  25. })
  26. };