Back to Swr

Refetch Interval

examples/refetch-interval/README.md

2.4.1635 B
Original Source

Refetch Interval

One-Click Deploy

Deploy your own SWR project with Vercel Now.

How to Use

Download the example:

bash
curl https://codeload.github.com/vercel/swr/tar.gz/main | tar -xz --strip=2 swr-main/examples/refetch-interval
cd refetch-interval

Install it and run:

bash
yarn
yarn dev
# or
npm install
npm run dev

The Idea behind the Example

Show how to make SWR fetch the API again in an interval automatically to ensure the data is up-to-date.