Set and get URL parameters in Next.js
up vote
0
down vote
favorite
I want to know how to attach an ID for example at the end of the URL in Next.js and how to retrieve it in the destination page like this ...
<Link href={`/about/${id}`}><a>About</a></Link>
To be like this ...
/about/256983649012
And then retrieve it in the about page.
How can I do that?
And please keep in mind that I'm already aware of this approach ...
<Link href={{ pathname: 'about', query: { id: id }}}><a>About</a></Link>
But I don't really want to the link to be like this about?id=256983649012
reactjs react-router router next.js
add a comment |
up vote
0
down vote
favorite
I want to know how to attach an ID for example at the end of the URL in Next.js and how to retrieve it in the destination page like this ...
<Link href={`/about/${id}`}><a>About</a></Link>
To be like this ...
/about/256983649012
And then retrieve it in the about page.
How can I do that?
And please keep in mind that I'm already aware of this approach ...
<Link href={{ pathname: 'about', query: { id: id }}}><a>About</a></Link>
But I don't really want to the link to be like this about?id=256983649012
reactjs react-router router next.js
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to know how to attach an ID for example at the end of the URL in Next.js and how to retrieve it in the destination page like this ...
<Link href={`/about/${id}`}><a>About</a></Link>
To be like this ...
/about/256983649012
And then retrieve it in the about page.
How can I do that?
And please keep in mind that I'm already aware of this approach ...
<Link href={{ pathname: 'about', query: { id: id }}}><a>About</a></Link>
But I don't really want to the link to be like this about?id=256983649012
reactjs react-router router next.js
I want to know how to attach an ID for example at the end of the URL in Next.js and how to retrieve it in the destination page like this ...
<Link href={`/about/${id}`}><a>About</a></Link>
To be like this ...
/about/256983649012
And then retrieve it in the about page.
How can I do that?
And please keep in mind that I'm already aware of this approach ...
<Link href={{ pathname: 'about', query: { id: id }}}><a>About</a></Link>
But I don't really want to the link to be like this about?id=256983649012
reactjs react-router router next.js
reactjs react-router router next.js
asked 3 hours ago
Ruby
313220
313220
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204452%2fset-and-get-url-parameters-in-next-js%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password