step.rs 845 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #[derive(Debug)]
  15. struct Props {
  16. name: String,
  17. }
  18. // impl Properties for Props {
  19. // fn call(&self, ptr: *const ()) {}
  20. // // fn new() -> Self {
  21. // // todo!()
  22. // // }
  23. // }
  24. static Example: FC<Props> = |ctx, props| {
  25. ctx.view(html! {
  26. <div>
  27. <h1> "hello world!" </h1>
  28. <h1> "hello world!" </h1>
  29. <h1> "hello world!" </h1>
  30. <h1> "hello world!" </h1>
  31. </div>
  32. })
  33. };