Thursday, 10 March 2016

reactjs - TypeError: Cannot set property 'setState' of undefined. react

I did fetch data from NYTimes API and console log them.
My initial state is {searchResponse: null}
Then set state the response
this.setState=({searchResponse:response.data});
and pass it to another component named listview_component. In that component, I handle the null value of prop.



but the response from the API did not push in searchResponse. and show the error : TypeError: Cannot set property 'setState' of undefined.




How to solve this?



please check out this code
https://github.com/shojibMahabub/news-scroller/tree/develop

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...