Next.js Discord

Discord Forum

Link performs full reload

Answered
Orinoco Crocodile posted this in #help-forum
Open in Discord
Orinoco CrocodileOP
What could it be? How do I debug this? I'm using app router and relative links.
Answered by Orinoco Crocodile
Found the answer. Need to use as={Link} on the button. described here:

https://github.com/nextui-org/nextui/issues/490#issuecomment-1250362650
View full answer

5 Replies

low effort
Orinoco CrocodileOP
Sorry, let me elaborate.

I'm using next/link in a client side component

<Link href="/cheese/dashboard">...</Link>

inside cheese I have a layout.tsx. This one is fully reloaded (actually, the browser performs a full page reload) thus resetting states such as input values.
Orinoco CrocodileOP
I boiled it down to a nextui <Button> inside the link.
When a nextui <Button /> is present inside the <Link>, it performs a full page reload
Orinoco CrocodileOP
Found the answer. Need to use as={Link} on the button. described here:

https://github.com/nextui-org/nextui/issues/490#issuecomment-1250362650
Answer