Function leptos_dom::ssr::render_to_stream_with_prefix

source ·
pub fn render_to_stream_with_prefix(
    view: impl FnOnce() -> View + 'static,
    prefix: impl FnOnce() -> Oco<'static, str> + 'static
) -> impl Stream<Item = String>
Expand description

Renders a function to a stream of HTML strings. After the view runs, the prefix will run with the same scope. This can be used to generate additional HTML that has access to the same reactive graph.

This renders:

  1. the prefix
  2. the application shell a) HTML for everything that is not under a <Suspense/>, b) the fallback for any <Suspense/> component that is not already resolved, and c) JavaScript necessary to receive streaming Resource data.
  3. streaming Resource data. Resources begin loading on the server and are sent down to the browser to resolve. On the browser, if the app sees that it is waiting for a resource to resolve from the server, it doesn’t run it initially.
  4. HTML fragments to replace each <Suspense/> fallback with its actual data as the resources read under that <Suspense/> resolve.