step.rs 809 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //! An example that shows how to:
  2. //! create a scope,
  3. //! render a component,
  4. //! change some data
  5. //! render it again
  6. //! consume the diffs and write that to a renderer
  7. use dioxus_core::prelude::*;
  8. fn main() -> Result<(), ()> {
  9. let p1 = Props { name: "bob".into() };
  10. let mut vdom = VirtualDom::new_with_props(Example, p1);
  11. // vdom.progress()?;
  12. Ok(())
  13. }
  14. struct Props {
  15. name: String,
  16. }
  17. impl Properties for Props {
  18. fn call(&self, ptr: *const ()) {}
  19. // fn new() -> Self {
  20. // todo!()
  21. // }
  22. }
  23. static Example: FC<Props> = |ctx, props| {
  24. ctx.view(html! {
  25. <div>
  26. <h1> "hello world!" </h1>
  27. <h1> "hello world!" </h1>
  28. <h1> "hello world!" </h1>
  29. <h1> "hello world!" </h1>
  30. </div>
  31. })
  32. };