use_router.rs 423 B

12345678910111213
  1. use dioxus::prelude::ScopeState;
  2. use crate::{
  3. prelude::GenericRouterContext, routable::Routable,
  4. utils::use_router_internal::use_router_internal,
  5. };
  6. /// A hook that provides access to information about the router
  7. pub fn use_generic_router<R: Routable + Clone>(cx: &ScopeState) -> &GenericRouterContext<R> {
  8. use_router_internal(cx)
  9. .as_ref()
  10. .expect("use_route must have access to a router")
  11. }