Skip to content

go

go(target, nav?): void

Defined in: route.ts:170

Navigate to a new URL by pushing a new history entry.

Note that this happens synchronously, immediately updating route and processing any reactive updates based on that.

RouteTarget

A subset of the Route properties to navigate to. If neither p nor path is given, the current path is used. For other properties, an empty/default value is assumed if not given. For convenience:

  • You may pass a string instead of an object, which is interpreted as the path.
  • You may pass an array instead of an object, which is interpreted as the p array.
  • If you pass p, it may contain numbers, which will be converted to strings.
  • If you pass search, its values may be numbers, which will be converted to strings.

Examples:

// Navigate to /users/123
route.go("/users/123");
// Navigate to /users/123?tab=feed#top
route.go({p: ["users", 123], search: {tab: "feed"}, hash: "top"});

NavType = "go"

void