SWR Reference: useSWR, Mutations, Infinite Scroll, Revalidation and Next.js
SWR reference — stale-while-revalidate, mutations, and infinite scroll.
The mental model: serve cache immediately, revalidate in background
const { data, isLoading, isValidating } = useSWR<User>("/api/me", fetcher);
// isLoading = true only on first ...
releaserun.hashnode.dev2 min read