rename generic navigator to navigator
This commit is contained in:
1 parent
947a153347
commit
cc94711d62
2 files changed
+5
-5
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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::<RouterContext>()
|
||||
.expect("Must be called in a descendant of a Router component");
|
||||
|
||||
GenericNavigator(router)
|
||||
Navigator(router)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user