fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

Add support for unnamed routes #59

Closed fridays closed 7 years ago

fridays commented 7 years ago

Following https://github.com/fridays/next-routes/pull/58 this adds support for unnamed routes.

It assumes a route is unnamed if the first parameter starts with /

In this case, the page to render is mandatory and it will throw an error if it's not present.

routes.add('/blog/:slug', 'blog')
<Link route='/blog/hello-world'><a>Click</a></Link>