diff --git a/packages/router/src/contexts/navigator.rs b/packages/router/src/contexts/navigator.rs index 2d8623aa8..d6c08f485 100644 --- a/packages/router/src/contexts/navigator.rs +++ b/packages/router/src/contexts/navigator.rs @@ -2,9 +2,9 @@ use crate::prelude::{ExternalNavigationFailure, IntoRoutable, RouterContext}; /// A view into the navigation state of a router. #[derive(Clone)] -pub struct GenericNavigator(pub(crate) RouterContext); +pub struct Navigator(pub(crate) RouterContext); -impl GenericNavigator { +impl Navigator { /// Check whether there is a previous page to navigate back to. #[must_use] pub fn can_go_back(&self) -> bool { diff --git a/packages/router/src/hooks/use_navigator.rs b/packages/router/src/hooks/use_navigator.rs index aab64fdc2..b435e7f9e 100644 --- a/packages/router/src/hooks/use_navigator.rs +++ b/packages/router/src/hooks/use_navigator.rs @@ -1,6 +1,6 @@ use dioxus::prelude::ScopeState; -use crate::prelude::{GenericNavigator, RouterContext}; +use crate::prelude::{Navigator, RouterContext}; /// A hook that provides access to the navigator to change the router history. Unlike [`use_router`], this hook will not cause a rerender when the current route changes /// @@ -47,12 +47,12 @@ use crate::prelude::{GenericNavigator, RouterContext}; /// # let mut vdom = VirtualDom::new(App); /// # let _ = vdom.rebuild(); /// ``` -pub fn use_navigator(cx: &ScopeState) -> &GenericNavigator { +pub fn use_navigator(cx: &ScopeState) -> &Navigator { &*cx.use_hook(|| { let router = cx .consume_context::() .expect("Must be called in a descendant of a Router component"); - GenericNavigator(router) + Navigator(router) }) }