pub fn render_app_to_stream_with_context<IV>(
    options: LeptosOptions,
    additional_context: impl Fn() + 'static + Clone + Send,
    app_fn: impl Fn() -> IV + Clone + Send + 'static
) -> impl Fn(Request<Body>) -> Pin<Box<dyn Future<Output = Response<Body>> + Send + 'static>> + Clone + Send + 'static
where IV: IntoView,
Expand description

Returns an Axum Handler that listens for a GET request and tries to route it using leptos_router, serving an HTML stream of your application.

This version allows us to pass Axum State/Extension/Extractor or other infro from Axum or network layers above Leptos itself. To use it, you’ll need to write your own handler function that provides the data to leptos in a closure. An example is below

async fn custom_handler(Path(id): Path<String>, Extension(options): Extension<Arc<LeptosOptions>>, req: Request<Body>) -> Response{
    let handler = leptos_axum::render_app_to_stream_with_context((*options).clone(),
    || {
        provide_context(id.clone());
    },
    || view! { <TodoApp/> }
);
    handler(req).await.into_response()
}

Otherwise, this function is identical to render_app_to_stream.

§Provided Context Types

This function always provides context values including the following types: