Replies: 3 comments 6 replies
-
Hello! You could use a query param for that. Something like: <Link
href={{
pathname: "/story/test",
query: { loading: "on" },
}}
as="/story/test"
>
Hello
</Link> When clicking on the Link, you'll go to const { query } = useRouter()
console.log(query.loading) |
Beta Was this translation helpful? Give feedback.
-
Currently we're using global state as a hack around this, but it's not preserved when the user refreshes the page. Would love to be able to pass state to the next page when users click links. |
Beta Was this translation helpful? Give feedback.
-
pushState / replaceState are supported since 14.1: https://nextjs.org/blog/next-14-1 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
next/link can add state props, which can be received in next/router, similar to history.pushState, which can be used to control page loading when client-side rendering
Describe the solution you'd like
Can next/link come with an extra parameter so that it can be received in the router, like this
Describe alternatives you've considered
Beta Was this translation helpful? Give feedback.
All reactions