Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.02 KB

navigation.md

File metadata and controls

38 lines (31 loc) · 1.02 KB

Navigation

history objects may be used to programmatically change the current location using the following methods:

An example:

// Push a new entry onto the history stack.
history.push("/home");

// Push a new entry onto the history stack with a query string
// and some state. Location state does not appear in the URL.
history.push("/home?the=query", { some: "state" });

// If you prefer, use a location-like object to specify the URL.
// This is equivalent to the example above.
history.push(
  {
    pathname: "/home",
    search: "?the=query",
  },
  {
    some: state,
  }
);

// Go back to the previous history entry. The following
// two lines are synonymous.
history.go(-1);
history.back();