Skip to content
Advertisement

Why is axios not returning correctly

I am trying to replace a fetch with axios. I keep getting undefined in my console log.

JavaScript

… the commented out fetch is working. I just now added the .json even though axios should not need it. Neither way works. What am I doing wrong?

Advertisement

Answer

Did you even console.log(response) just to see whats inside of it?

I guess you dont, because response is an object witch has no json key in it. You should use response.data

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement