nested.rs 814 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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.view(html! {
  10. <div>
  11. <h1> "This is the header bar" </h1>
  12. <h1> "Idnt it awesome" </h1>
  13. <button onclick={move |_| handler1()}> "Click me" </button>
  14. </div>
  15. })
  16. };
  17. static Bottom: FC<()> = |ctx, props| {
  18. ctx.view(html! {
  19. <div>
  20. <h1> "bruh 1" </h1>
  21. <h1> "bruh 2" </h1>
  22. </div>
  23. })
  24. };
  25. static Example: FC<()> = |ctx, props| {
  26. ctx.view(html! {
  27. <div>
  28. <h1> "BROSKI!" </h1>
  29. <h1> "DRO!" </h1>
  30. </div>
  31. })
  32. };