Have been facing issue while iterating through a list and printing elements in React.
The React Code is:
import React from \'react\';
import ReactDOM fro
what you can do is extract your js code from the render method in a separate method like so:
renderList() {
return this.state.myData.map((item) => {
{item.title}
{item.description}
})
}
then in your render method:
render() {
if(this.state.myData.length){
return (
{this.renderList()}
);
}
else
{
return (
Loading...
);
}
}