W
W
WoopsWoops2017-03-29 18:13:47
JavaScript
WoopsWoops, 2017-03-29 18:13:47

Why is the first response null?

There is a simple request to api in action, which I execute in componentDidMount, then in render I check the console with my response log, it shows this, first null, then my object with data is pulled up, but here is the problem, that I need to run the map over the data when I do writes me something in the spirit - this.props.data.map is null, how to fix it? maybe I'm not calling the action at the right time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Samsonov, 2017-03-29
@WoopsWoops

I'm not good at React. But.
After reading the documentation, I realized that in general, as in Vue, everything.
Crits on map is not a function are easy to fix - define the this.props.data.map skeleton as specified in the documentation.
What you described from the console log is unlikely to be a response, if the request is sent once, then the response will come once. It's just that initially the react renders what is in the template, and as soon as it receives the data, it updates it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question