Function leptos_dom::ssr::render_to_string
source · pub fn render_to_string<F, N>(f: F) -> Stringwhere
F: FnOnce(Scope) -> N + 'static,
N: IntoView,
Expand description
Renders the given function to a static HTML string.
let html = leptos::ssr::render_to_string(|cx| view! { cx,
<p>"Hello, world!"</p>
});
// trim off the beginning, which has a bunch of hydration info, for comparison
assert!(html.contains("Hello, world!</p>"));