Function leptos_dom::ssr::render_to_string

source ยท
pub fn render_to_string<F, N>(f: F) -> Oco<'static, str>
where F: FnOnce() -> N + 'static, N: IntoView,
Expand description

Renders the given function to a static HTML string.

let html = leptos::ssr::render_to_string(|| view! {
  <p>"Hello, world!"</p>
});
// trim off the beginning, which has a bunch of hydration info, for comparison
assert!(html.contains("Hello, world!</p>"));