freya::_docs::router

Module native_router

Source
Expand description

ยงNative Router

By default, Freya Router is pretty simple, so there are certain integrations that are not provided by default, such as as back and forward navigation with the mouse buttons. For things like this exists NativeRouter, a thin wrapper component that adds these missing integrations.

You simply need to wrap your Router content inside the NativeRouter component.

Example (based on the example from router):

fn AppSidebar() -> Element {
    rsx!(
        NativeRouter {
            Body {
                Link {
                    to: Route::Home,
                    label {
                        "Home"
                    }
                },
                Link {
                    to: Route::Other,
                    label {
                        "Other"
                    }
                },
                // Rest of app
            }
        }
    )
}