What Is SWR and How Do You Use It in Next.js?
SWR (state-while-revalidate) is a data fetching method built by Vercel. Using SWR, a website displays cached content while it fetches up-to-date content in the background. How Does SWR Work? Normally, you’dfetch data using Axios or the fetch method. These methods connect to the data resource, retrieve and return the data then kill the connection. However, SWR fetches data differently. It works in three steps: SWR is not a replacement for the fetch API....