You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using SWR with Next.js, which I'm both extremely new to, and I've been trying to fetch data from a URL with useSWR. However, even if there exists response data from the fetcher, the data returned from useSWR is still always undefined and my application always displays "loading...". Below is a snippet of the code relating to this:
const HomePage = memo(props => {
const { data, error } = useSWR(url, fetcher({ query: {} }));
if (error) return <div>failed to load</div>;
if (!data) return <div>loading...</div>;
...
Hi, I'm using SWR with Next.js, which I'm both extremely new to, and I've been trying to fetch data from a URL with
useSWR
. However, even if there exists response data from the fetcher, the data returned fromuseSWR
is still always undefined and my application always displays "loading...". Below is a snippet of the code relating to this:Fetcher function:
The text was updated successfully, but these errors were encountered: