Function dioxus_router::components::GoBackButton
source · pub fn GoBackButton<'a>(cx: Scope<'a, HistoryButtonProps<'a>>) -> Element<'_>Expand description
A button to go back through the navigation history. Similar to a browsers back button.
Only works as descendant of a [Link] component, otherwise it will be inactive.
The button will disable itself if it is known that no prior history is available.
Panic
- When the
GoBackButtonis not nested within a [Link] component hook, but only in debug builds.
Example
#[derive(Clone, Routable)]
enum Route {
#[route("/")]
Index {},
}
fn App(cx: Scope) -> Element {
render! {
Router::<Route> {}
}
}
#[inline_props]
fn Index(cx: Scope) -> Element {
render! {
GoBackButton {
"go back"
}
}
}