wip: making progress on diffing and hydration
This commit is contained in:
1 parent
e5c88fe3a4
commit
49856ccd68
34 files changed
+1023
-750
No files matched your search
@@ -0,0 +1,10 @@
|
||||
//! Example: realworld usage of hydration
|
||||
//!
|
||||
//!
|
||||
use dioxus::virtual_dom::VirtualDom;
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core::prelude::*;
|
||||
use dioxus_hooks::use_state;
|
||||
use dioxus_html as dioxus_elements;
|
||||
|
||||
fn main() {}
|
||||
@@ -22,7 +22,7 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
let dom = VirtualDom::launch_with_props_in_place(Example, ExampleProps { initial_name });
|
||||
|
||||
Ok(Response::builder(200)
|
||||
.body(format!("{}", dioxus_ssr::render_vdom(&dom)))
|
||||
.body(format!("{}", dioxus_ssr::render_vdom(&dom, |c| c)))
|
||||
.content_type(tide::http::mime::HTML)
|
||||
.build())
|
||||
});
|
||||
|
||||
@@ -15,8 +15,11 @@ fn main() {
|
||||
let mut dom = VirtualDom::new(App);
|
||||
dom.rebuild_in_place().expect("failed to run virtualdom");
|
||||
|
||||
file.write_fmt(format_args!("{}", TextRenderer::from_vdom(&dom)))
|
||||
.unwrap();
|
||||
file.write_fmt(format_args!(
|
||||
"{}",
|
||||
TextRenderer::from_vdom(&dom, Default::default())
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
pub static App: FC<()> = |cx| {
|
||||
|
||||
Reference in new issue
Block a user