Next.js Discord

Discord Forum

Refresh server component data on interval

Answered
Matt posted this in #help-forum
Open in Discord
What's the right way to refresh a server component's data on an interval? I have a page that often has stale data and I'd like to use a client component to refresh after a few minutes of idle time. What's the most idiomatic way to do this?
Answered by Rafael Almeida
I believe you can do that with router.refresh in a client component: https://nextjs.org/docs/app/building-your-application/caching#routerrefresh
View full answer

2 Replies

I believe you can do that with router.refresh in a client component: https://nextjs.org/docs/app/building-your-application/caching#routerrefresh
Answer
Worked perfectly, thank you!