Deploy your own SWR project with Vercel.
Download the example:
curl https://codeload.github.com/vercel/swr/tar.gz/main | tar -xz --strip=2 swr-main/examples/server-render
cd server-render
Install it and run:
yarn
yarn dev
# or
npm install
npm run dev
This example shows how to combine Next.js getServerSideProps with the SWR fallbackData
option to support Server-Side Rendering.
The application will fetch the data server-side and then receive it as props, that data will be passed as fallbackData
to SWR, once the application starts client-side SWR will revalidate it against the API and update the DOM, if it's required, with the new data.