Next.js Discord

Discord Forum

Trying to fetch data from an API but I keep getting .map is not a function :(

Answered
Ojos Azules posted this in #help-forum
Open in Discord
Ojos AzulesOP
I'm trying to get some data from my Strapi but for some reason, I keep getting the error "skills.map is not a function". I have been reading around and this seems to be an issue because objects cannot be mapped, but I don't understand what I have to change with my code. I will attach my code and the console log of the data I'm fetching. If someone could please help me out that would be amazing.
Answered by joulev
skills.data.map instead of skills.map
View full answer

4 Replies

Answer
@joulev skills.data.map instead of skills.map
Ojos AzulesOP
thank you that actually works 😭 . One more question now, how would I make an interface or type work with the skill?
Ojos AzulesOP
oh okay my bad. thanks againnn