leptos_router 0.0.4

Router for the Leptos web framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::use_route;
use leptos::*;

/// Displays the child route nested in a parent route, allowing you to control exactly where
/// that child route is displayed. Renders nothing if there is no nested child.
#[component]
pub fn Outlet(cx: Scope) -> Child {
    let route = use_route(cx);
    create_memo(cx, move |_| {
        route.child().map(|child| {
            provide_context(child.cx(), child.clone());
            child.outlet().into_child(child.cx())
        })
    })
    .into_child(cx)
}