step.rs 717 B

123456789101112131415161718192021222324252627282930313233
  1. use dioxus_core::{component::Properties, prelude::*};
  2. fn main() -> Result<(), ()> {
  3. let p1 = SomeProps { name: "bob".into() };
  4. let mut vdom = VirtualDom::new_with_props(Example, p1);
  5. Ok(())
  6. }
  7. #[derive(Debug, PartialEq, Props)]
  8. struct SomeProps {
  9. name: String,
  10. }
  11. static Example: FC<SomeProps> = |ctx, _props| {
  12. ctx.render(html! {
  13. <div>
  14. <h1> "hello world!" </h1>
  15. <h1> "hello world!" </h1>
  16. <h1> "hello world!" </h1>
  17. <h1> "hello world!" </h1>
  18. </div>
  19. })
  20. };
  21. // toodo: derive this
  22. impl Properties for SomeProps {
  23. type Builder = SomePropsBuilder<((),)>;
  24. fn builder() -> Self::Builder {
  25. SomeProps::builder()
  26. }
  27. }