Skip to content

How to make a redirect with a dynamic path? #10504

Closed Answered by brophdawg11
arloktev asked this question in Q&A
Discussion options

You must be logged in to vote

Your loader receives the request and params:

let router = createBrowserRouter([{
  path: "/post/:id",
  loader: ({ request, params }) => redirect(`/article/${params.id}`);
}, {
  path: "/article/:id",
  loader: () => { ... },
  Component: Article,
}]);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arloktev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants