ssr.rs 493 B

1234567891011121314151617181920212223242526
  1. #![allow(non_upper_case_globals)]
  2. use dioxus::prelude::*;
  3. use dioxus::ssr;
  4. fn main() {
  5. let mut vdom = VirtualDom::new(App);
  6. // vdom.rebuild_in_place().expect("Rebuilding failed");
  7. println!("{}", ssr::render_vdom(&vdom, |c| c));
  8. }
  9. static App: FC<()> = |(cx, props)| {
  10. cx.render(rsx!(
  11. div {
  12. h1 { "Title" }
  13. p { "Body" }
  14. }
  15. ))
  16. };
  17. struct MyProps<'a> {
  18. text: &'a str,
  19. }
  20. fn App2(cx: Context, props: &MyProps) -> Element {
  21. None
  22. }