codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -0,0 +1,42 @@
|
||||
//! Example: SSR
|
||||
//!
|
||||
//! This example shows how we can render the Dioxus Virtualdom using SSR.
|
||||
//! Dioxus' SSR is quite comprehensive and can generate a number of utility markers for things like hydration.
|
||||
//!
|
||||
//! You can also render without any markers to get a clean HTML output.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// We can render VirtualDoms
|
||||
let vdom = VirtualDom::prebuilt(app);
|
||||
println!("{}", dioxus_ssr::render(&vdom));
|
||||
|
||||
// Or we can render rsx! calls themselves
|
||||
println!(
|
||||
"{}",
|
||||
dioxus_ssr::render_element(rsx! {
|
||||
div {
|
||||
h1 { "Hello, world!" }
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// We can configure the SSR rendering to add ids for rehydration
|
||||
println!("{}", dioxus_ssr::pre_render(&vdom));
|
||||
|
||||
// We can render to a buf directly too
|
||||
let mut file = String::new();
|
||||
let mut renderer = dioxus_ssr::Renderer::default();
|
||||
renderer.render_to(&mut file, &vdom).unwrap();
|
||||
println!("{file}");
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
rsx!(
|
||||
div {
|
||||
h1 { "Title" }
|
||||
p { "Body" }
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user