You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Routes to render correctly on both client and server.
Be able to define a link using next/link with only one prop, href, which contains the actual url.
Define routes in one place.
Example route: /posts/:id.
Current Behavior
The next/link component requires manually passing url parameters. This can be a bit inconvenient when attempting to navigate to a url string from a json response.
For example, if you have a simple blog backend that outputs a json response: { "posts": [{... "link": "/posts/my-first-post"}] }
Doing something like this does not work: posts.map(post => <Link href={post.link} />)
The link will go to a 404 page and then it seems like the browser does a full reload and it gets rendered properly by the server.
Ideas
Allow custom routes to be defined in next.config.js and have the framework configure them
404 error flashes when rendering custom routes on clientside
Related issues:
#2208
#2833
Expected Behavior
next/link
with only one prop,href
, which contains the actual url.Example route:
/posts/:id
.Current Behavior
next/link
component requires manually passing url parameters. This can be a bit inconvenient when attempting to navigate to a url string from a json response.For example, if you have a simple blog backend that outputs a json response:
{ "posts": [{... "link": "/posts/my-first-post"}] }
Doing something like this does not work:
posts.map(post => <Link href={post.link} />)
The link will go to a 404 page and then it seems like the browser does a full reload and it gets rendered properly by the server.
Ideas
next.config.js
Somewhere in
const { prepare } = require('next')
The text was updated successfully, but these errors were encountered: