Refresh server component data on interval
Answered
Matt posted this in #help-forum
MattOP
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#routerrefresh2 Replies
I believe you can do that with
router.refresh in a client component: https://nextjs.org/docs/app/building-your-application/caching#routerrefreshAnswer
MattOP
Worked perfectly, thank you!