Next.js Discord

Discord Forum

Error using useSWR

Unanswered
Japanese jack mackerel posted this in #help-forum
Open in Discord
Japanese jack mackerelOP
So im calling the useSWR hook and passing in an intentionally incorrect file path. for some reason even though it returns an error, data is getting set to an error: "404" but the error value itself is remaining as undefined

2 Replies

Northern Wheatear
Are you using it in an client component?
You can use it only in a client component with "use client" otherwise it returns undefined