Next-routes two components with same main route
See original GitHub issueHi, I want to have this configuration in the routes file with next-routes:
module.exports = routes()
.add({ name: "perfil", pattern: "/perfil/:id", page: "perfil" })
.add({ name: "edit", pattern: "/perfil/:id/edit", page: "edit" })
One component called “edit” that has the route /perfil/:id/edit and other for “perfil” which is /perfil/:id.
But that does not work, the component “perfil” gives me the route /perfil/:id and the component “edit” gives me /edit. How can i resolve this?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
Routing: Introduction - Next.js
The Next.js router allows you to do client-side route transitions between pages, similar to a single-page application. A React component called Link is...
Read more >How can I use one component (page) for multiple route in ...
Inside the route directory you can import and export the component from another directory. Inside your second route /myPage2/index.js :
Read more >fridays/next-routes: Universal dynamic routes for Next.js - GitHub
This file is used both on the server and the client. API: routes.add([name], pattern = /name, page = name); routes.add(object).
Read more >A Beginner's Guide to Routing in Next.js, with Examples
The site will have two simple routes and two dynamic routes (we'll get to the meaning ... Next.js also provides us with a...
Read more >Routing in Next.js – A Complete Beginner's Guide
A page in Next.js is a React component that has a route based on its file name. Consider this folder structure as an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You should put the most specific first. Because here
/product/123
matches/:id
, whereid
isproduct/123
.@juliankoehn the example you sent is using now, which is great, I use it. But what I was talking about is this https://github.com/zeit/next.js/blob/canary/packages/next/README.md#custom-server-and-routing