1
0

step.rs 638 B

12345678910111213141516171819202122232425262728293031323334
  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::*, scope::Scope};
  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 new() -> Self {
  19. todo!()
  20. }
  21. }
  22. static Example: FC<Props> = |ctx| {
  23. ctx.view(html! {
  24. <div>
  25. <h1> </h1>
  26. </div>
  27. })
  28. };