dioxus/examples/ssr.rs

20 lines
376 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);
vdom.rebuild_in_place().expect("Rebuilding failed");
println!("{}", ssr::render_vdom(&vdom, |c| c));
2021-07-11 23:31:07 +00:00
}
static App: FC<()> = |cx| {
2021-07-11 23:31:07 +00:00
cx.render(rsx!(
div {
h1 { "Title" }
p { "Body" }
}
))
};