/// This hook provides access to information about the current location in the
/// context of a [`Router`]. If this function is called outside of a `Router`
/// component it will panic.
This hook provides access to information about the current location in the
context of a [`Router`]. If this function is called outside of a `Router`
component it will panic.
This hook provides access to information about the current location in the context of a [ ` Router ` ] . If this function is called outside of a ` Router ` component it will panic .
pub fn use_route(cx: &ScopeState) -> &UseRoute {
    let handle = cx.use_hook(|_| {
        let router = cx
            .consume_context::<RouterService>()
            .expect("Cannot call use_route outside the scope of a Router component");
        let route_context = cx.consume_context::<RouteContext>();
        router.subscribe_onchange(cx.scope_id());
        UseRouteListener {
            state: UseRoute {
                route_context,
                route: router.current_location(),
            },
            router,
            scope: cx.scope_id(),
        }
    });
    handle.state.route = handle.router.current_location();
    &handle.state
}
pub fn use_route ( cx : & ScopeState ) -> & UseRoute { let handle = cx . use_hook ( | _ | { let router = cx . consume_context :: < RouterService > ( ) . expect ( " " ) ; let route_context = cx . consume_context :: < RouteContext > ( ) ; router . subscribe_onchange ( cx . scope_id ( ) ) ; UseRouteListener { state : UseRoute { route_context , route : router . current_location ( ) , } , router , scope : cx . scope_id ( ) , } } ) ; handle . state . route = handle . router . current_location ( ) ; & handle . state }
This hook provides access to information about the current location in the
context of a [`Router`].
This hook provides access to information about the current location in the context of a [ ` Router ` ] .
cx
&ScopeState