Skip to content

AK0051

No route matched the current URL

What happened

The router could not find a route definition that matches the current URL. The user navigated to a path that is not covered by any of your route definitions.

How to fix

Add a catch-all route using [...rest] (or *) to handle unmatched URLs, typically rendering a 404 page.

Example

ts
// Bad — no fallback for unknown paths
const routes = [
  { path: "/", component: Home },
  { path: "/about", component: About },
];

// Good — add a catch-all route
const routes = [
  { path: "/", component: Home },
  { path: "/about", component: About },
  { path: "[...rest]", component: NotFound },
];

Released under the MIT License.