Function leptos_dom::ssr::render_to_stream_with_prefix
source · pub fn render_to_stream_with_prefix(
view: impl FnOnce(Scope) -> View + 'static,
prefix: impl FnOnce(Scope) -> Cow<'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 Scope
.
This renders:
- the prefix
- the application shell
a) HTML for everything that is not under a
<Suspense/>
, b) thefallback
for any<Suspense/>
component that is not already resolved, and c) JavaScript necessary to receive streaming Resource data. - 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.
- HTML fragments to replace each
<Suspense/>
fallback with its actual data as the resources read under that<Suspense/>
resolve.