Next.js Discord

Discord Forum

Server component doesn't prerender client components after navigating through Link

Answered
French Lop posted this in #help-forum
Open in Discord
French LopOP
Hey I am having an error in next.js . When I render the page, it renders ShowMore component the same in every <Link> I go, but when I use inline tsx elements, it works fine. How do I make the component render normally?

https://paste.gg/p/anonymous/4aa1d2ae20b24a5a84a2e1d12aad78ba
Answered by French Lop
I solved the issue. I had to add a key parameter to each ShowMore component like "key={index + params.key}" where "params.key" is a search parameter I pass with an URL to make nextjs render components as different ones when I go to the same page through a Link.
View full answer

1 Reply

French LopOP
I solved the issue. I had to add a key parameter to each ShowMore component like "key={index + params.key}" where "params.key" is a search parameter I pass with an URL to make nextjs render components as different ones when I go to the same page through a Link.
Answer