Problems trying to return api data without a class

Posted by Prem Tiwari | Updated on

Are you facing problem and trying to return api data without a class? Normally we would just load the data and then render our app. But React expects some initial state for all that data and needs to update itself once that AJAX request is complete. For this reason, you need to store all that data in the app’s state.

Here’s how that looks:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers