History Buttons

Some platforms, like web browsers, provide users with an easy way to navigatethrough an app's history. They have UI elements or integrate with the OS.

However, native platforms usually don't provide such amenities, which means thatapps wanting users to have access to them, need to implement them. For thisreason, the router comes with two components, which emulate a browser's back andforward buttons:

If you want to navigate through the history programmatically, take a look atprogrammatic navigation.

fn HistoryNavigation(cx: Scope) -> Element {
    render! {
        GoBackButton {
            "Back to the Past"
        }
        GoForwardButton {
            "Back to the Future" /* You see what I did there? 😉 */
        }
    }
}

As you might know, browsers usually disable the back and forward buttons ifthere is no history to navigate to. The router's history buttons try to do thattoo, but depending on the [history provider] that might not be possible.

Importantly, neither [WebHistory] supports that feature.This is due to limitations of the browser History API.

However, in both cases, the router will just ignore button presses, if there isno history to navigate to.

Also, when using [WebHistory], the history buttons mightnavigate a user to a history entry outside your app.