Man*_*tro 2 react-native fetch-api
我正在尝试使用本机响应简单的应用程序.我想从页面下载一个json数组并将其显示为listview.我这样做
var listApp = React.createClass({
fetchData : function() {
fetch(requestURL)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
.done();
},
componentDidMount: function() {
this.fetchData();
this.setState({
dataSource: this.state.dataSource.cloneWithRows(elements)
});
},
Run Code Online (Sandbox Code Playgroud)
但是这样做我fetch is not a function从Chrome调试器中得到了错误.我以这种方式获取var fetch = require("fetch");
| 归档时间: |
|
| 查看次数: |
4401 次 |
| 最近记录: |