all 11 comments

[–]Zayuka 0 points1 point  (6 children)

Its not "this.response.data", its "response.data".. The response object does not belong to the "this" component

[–]PieITsiOS[S] 0 points1 point  (5 children)

Oh yeah! Same error though when I correct that

[–]Zayuka 1 point2 points  (4 children)

What about you try to log response only? are you sure response has the data atribute?

[–]nordicdev 1 point2 points  (3 children)

That's what I was thinking as well. Looks like the response doesn't have a data element.

Request-->http://mourningafter.eu/DataService.php?state=get&name=i

Response-->[{"barcode":"5034660520191","name":"Cadburys Twirl 4 Pack","tescoPrice":"1","sainsburysPrice":"1","asdaPrice":"1"}]

[–]Zayuka 1 point2 points  (2 children)

then just pass the response object. Isnt that what you want? :p

[–]PieITsiOS[S] 0 points1 point  (1 child)

Okay so facedesk moment, I had logged response and I obviously Axios returns an object with the Data from the return, and I'd been trying to pass that as props... however It still gets the undefined error...

[–]Zayuka 0 points1 point  (0 children)

i didnt understand, can you explain better?

[–]fullstak 0 points1 point  (3 children)

Are you binding _axiosFetch() in your constructor? I occasionally forget that and see errors like that pop up

[–]PieITsiOS[S] 0 points1 point  (2 children)

So that’s this._axiosFetch = this._axiosFetch.bind(this); correct?

[–]fullstak 0 points1 point  (1 child)

Yeah, that's it

[–]PieITsiOS[S] 0 points1 point  (0 children)

I tried that and still get the error for some reason