History
Information about the history is accessible through the useHistory hook.
Always use this hook instead of using window.history
directly, as concurrent
rendering with react causes multiple different histories to exist at the same
time.
function Route() {
let history = useHistory()
...
}
History conforms the History interface, so take a look at this native web platform api if you are not familiar.
Be aware that the history is only available in the browser. Take into account
that history is undefined
when rendering on the server.