I am trying to make REST call from a react component and render the returned JSON data into the DOM
Here is my component
import React from \'react\'; ex
You can try this for your render method:
render() { var resultNodes = this.state.items.map(function(result, index) { return ( result ); }.bind(this)); return ( {resultNodes} ); } and don't forget to use .bind(this) for your fetch(...).then(), I don't think it could work without... 0 讨论(0) 查看其它4个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
and don't forget to use .bind(this) for your fetch(...).then(), I don't think it could work without...
.bind(this)
fetch(...).then()