History #

History exposes the browser history stack to React

Methods #

length() #

Returns a Promise that is resolved with the current history length

state() #

Returns a Promise that is resolved with the current history state

back() #

Returns a Promise that is resolved after the history is moved back

forward() #

Returns a Promise that is resolved after the history is moved forward

go(delta) #

Takes a number of steps, and moves the history by that delta. Returns a Promise that is resolved after the move is completed.

@param delta - The number of steps to move the current history state. A positive number moves the history forward, a negative number moves the history back.

pushState(state, title, url) #

Push a new state onto the history stack. The first argument is the state object to push onto the stack; the second argument is the new title for the window. An optional third argument is the new URL to display in the navigation bar.

@param state - An object to push onto the stack @param title - A string to set as the window title @param url (optional) - The URL to show in the navigation bar

replaceState(state, title, url) #

Replace the top state onto the history stack. The first argument is the state object to place at the top of the stack; the second argument is the new title for the window. An optional third argument is the new URL to display in the navigation bar.

@param state - An object to push onto the stack @param title - A string to set as the window title @param url (optional) - The URL to show in the navigation bar

You can file an issue on GitHub if you see a typo or error on this page!