Next suspense with swr, "Fallback data is required when using suspense in SSR."

32 Views Asked by At

I'm trying to use React Suspense within a Next project

I'm not using SSR, the app is only used as client rendering

Supense works, but I got this error :

Fallback data is required when using suspense in SSR.

  <Suspense fallback={<Skeleton />}>
     <Foo />
  </Suspense>
export const Foo = () => {
    const { data, error, isLoading } = useSWR(
        `/api/foo`,
        async (url: string) => await ApiClient.GET(url),
        { suspense: true }
    )
    return <Bar data={data} />
}
0

There are 0 best solutions below