fridays / next-routes

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

How to call functions on custom alias? #116

Closed gcfabri closed 6 years ago

gcfabri commented 7 years ago

I would like to do something like this:

as={`/p/${post.title.trim().replace(/\s+/g, `-`)}`}
fridays commented 6 years ago

You can do it like this:

routes.add('post', '/p/:title')
<Link route='post' params={{title: post.title.trim().replace(/\s+/g, `-`)}}> ...