Function yew_router::hooks::use_route

source ·
pub fn use_route<'hook, R>() -> impl 'hook + Hook<Output = Option<R>>where
    R: Routable + 'static + 'hook,
Expand description

A hook to access the current route.

This hook will return None if there’s no available location or none of the routes match.

Note

If your Routable has a #[not_found] route, you can use .unwrap_or_default() instead of .unwrap() to unwrap.

Note

When used in function components and hooks, this hook is equivalent to:

pub fn use_route<R>() -> Option<R>
where
    R: Routable + 'static,
{
    /* implementation omitted */
}