dioxus/examples/ssr.rs

27 lines
508 B
Rust
Raw Normal View History

#![allow(non_upper_case_globals)]
2021-07-11 23:31:07 +00:00
use dioxus::prelude::*;
use dioxus::ssr;
fn main() {
let mut vdom = VirtualDom::new(App);
2021-08-18 02:25:09 +00:00
// vdom.rebuild_in_place().expect("Rebuilding failed");
println!("{}", ssr::render_vdom(&vdom, |c| c));
2021-07-11 23:31:07 +00:00
}
2021-10-16 21:37:28 +00:00
static App: FC<()> = |(cx, props)| {
2021-07-11 23:31:07 +00:00
cx.render(rsx!(
div {
h1 { "Title" }
p { "Body" }
}
))
};
2021-08-18 02:25:09 +00:00
struct MyProps<'a> {
text: &'a str,
}
2021-09-21 17:42:52 +00:00
fn App2<'a>(cx: Context<'a>, props: &'a MyProps) -> DomTree<'a> {
2021-08-18 02:25:09 +00:00
None
}