Answers for "loop through api response in react"

0

loop through api response in react

render() {
    return (
        <div>{this.renderData()}</div>
    )
}
Posted by: Guest on February-26-2020
0

loop through api response in react

renderData() {
    if (!this.state.trails) {
        return null;
    } 
    return this.state.trails.map(trail => <p>{trail.name}</p>);
}
Posted by: Guest on February-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language