dioxus/examples/ssr.rs

27 lines
488 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
}
static App: FC<()> = |cx| {
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,
}
fn App2<'a>(cx: Context<'a, MyProps>) -> DomTree<'a> {
None
}