Query data with Next.js
Has anyone found a good way to query for data when using Next.js. I tried using useSWR (https://swr.vercel.app/) and it works, but I'm not sure if that is the recommended way of doing it?
I find it cumbersome to use useEffect and set a state each time I want to query for data.
Any good suggestions?
I find it cumbersome to use useEffect and set a state each time I want to query for data.
Any good suggestions?
SWR is a React Hooks library for data fetching. SWR first returns the data from cache (stale), then sends the fetch request (revalidate), and finally comes with the up-to-date data again.