-
Is there a way to query the remaining time in the refresh interval for a URL? |
Beta Was this translation helpful? Give feedback.
Answered by
shuding
Oct 14, 2020
Replies: 1 comment 1 reply
-
SWR doesn't have a way to do that currently. As a workaround, you can do this manually: const { data, mutate } = useSWR('/api')
// you can use any lib such as https://usehooks-typescript.com/use-interval
// to control the behavior precisely, even calculate the remaining time
useInterval(() => {
// this will trigger a refresh
mutate()
}, 5000) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
niraj8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SWR doesn't have a way to do that currently. As a workaround, you can do this manually: