loop through api response in react code example
Example 1: loop through api response in react
render() {
return (
{this.renderData()}
)
}
Example 2: loop through api response in react
renderData() {
if (!this.state.trails) {
return null;
}
return this.state.trails.map(trail => {trail.name}
);
}