DEV Community

Discussion on: Answers to Common Next.js Questions

Collapse
 
perssondennis profile image
Dennis Persson

Thanks :)

router.refresh() should work I suppose, since it do refresh Server Components.

Although, I wouldn't recommend it. I would probably rather turn the Server Component into a Client Component and read the URL with useRouter (or pass as prop if they are not needed to be persisted in the URL).

The reason? Because that way, it all is handled automatically. Manually having to refresh the page when URL is changed is error-prone, one day that will likely turn into a bug.

Plus, if you would need to fully refresh your Server Component to get the URL params to it, you are probably better of with a Client Component, performance-wise.