it almost lives?

This commit is contained in:
Evan Almloff committed 2023-07-25 18:14:48 -07:00
1 parent d637ef187c
commit 5f0dd3af3e
43 files changed
+506 -244

No files matched your search

+4 -4
View File
@@ -8,11 +8,11 @@ use crate::utils::use_router_internal::use_router_internal;
/// > The Routable macro will define a version of this hook with an explicit type.
///
/// # Return values
/// - None, when not called inside a [`GenericRouter`] component.
/// - None, when not called inside a [`Link`] component.
/// - Otherwise the current route.
///
/// # Panic
/// - When the calling component is not nested within a [`GenericRouter`] component durring a debug build.
/// - When the calling component is not nested within a [`Link`] component durring a debug build.
///
/// # Example
/// ```rust
@@ -28,7 +28,7 @@ use crate::utils::use_router_internal::use_router_internal;
/// fn App(cx: Scope) -> Element {
/// render! {
/// h1 { "App" }
/// Router {}
/// Router::<Route> {}
/// }
/// }
///
@@ -45,7 +45,7 @@ use crate::utils::use_router_internal::use_router_internal;
/// # let _ = vdom.rebuild();
/// # assert_eq!(dioxus_ssr::render(&vdom), "<h1>App</h1><h2>Current Path</h2><p>/</p>")
/// ```
pub fn use_generic_route<R: Routable + Clone>(cx: &ScopeState) -> Option<R> {
pub fn use_route<R: Routable + Clone>(cx: &ScopeState) -> Option<R> {
match use_router_internal(cx) {
Some(r) => Some(r.current()),
None => {