Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support catch all routes #13

Merged
merged 8 commits into from
Apr 20, 2021
Merged

Conversation

ckastbjerg
Copy link
Owner

@ckastbjerg ckastbjerg commented Apr 13, 2021

This will enable the following use cases with the getRoute util:

getRoute("/optional-catch-all");
getRoute({ route: "/optional-catch-all", path: "/a/b/c" });
getRoute({ route: "/catch-all", path: "/a/b/c" })
getRoute({
  route: "/nested-catch-all/[dynamic]/slugs",
  params: { dynamic: 1 },
  path: "/a/b/c",
})

Or with an abstraction on top of the next/link component:

<Link to="/optional-catch-all">Optional catch all (no path)</Link>
<Link to={{ route: "/optional-catch-all", path: "/a/b/c" }}>
  Optional catch all
</Link>
<Link to={{ route: "/catch-all", path: "/a/b/c" }}>
  Catch all
</Link>
<Link
  to={{
    route: "/nested-catch-all/[dynamic]/slugs",
    params: { dynamic: 1 },
    path: "/a/b/c",
  }}
>
  Nested catch all (with params)
</Link>

@ckastbjerg ckastbjerg linked an issue Apr 13, 2021 that may be closed by this pull request
@ckastbjerg ckastbjerg self-assigned this Apr 14, 2021
@ckastbjerg ckastbjerg marked this pull request as ready for review April 18, 2021 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional catch all routes [[...category]] route ?
1 participant