-
Hi! I'm learning the combo NextJS / SWR by trying to make a simple dashboard displaying user email. I have an external API returning JSON data, for example the API endpoint _app.js file:
index.js file:
lib/useUser.js file:
When hitting the index page, I'm always getting the error: Can someone help me please? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Your useUser hook returns an object with data and mutate but in your componente you name them user and mutate without doing Once you fix that, from what I saw your data has a key user and inside it has the email, so you should do |
Beta Was this translation helpful? Give feedback.
-
Ok I found the problem. It was a CORS issue... I didn't see the warnings, was focused in the network tab... Thank you @sergiodxa. |
Beta Was this translation helpful? Give feedback.
Ok I found the problem. It was a CORS issue... I didn't see the warnings, was focused in the network tab... Thank you @sergiodxa.