【发布时间】:2018-10-23 03:41:59
【问题描述】:
我想从此 API https://facebook.github.io/react-native/movies.json 获取数据 但没有得到数据,也没有错误!!
这是我的代码
import React, { Component } from "react";
class App extends Component {
constructor() {
super();
this.state = {
data: []
};
}
componentDidMount() {
fetch("https://facebook.github.io/react-native/movies.json")
.then(Response => Response.json())
.then(findresponse => {
this.setState({
data: findresponse.movies
});
});
}
render() {
return (
<div>
{this.state.data.map((dynamicData, key) => (
<div>
<span>{dynamicData.releaseYear}</span>
</div>
))}
</div>
);
}
}
export default App;
请帮忙
【问题讨论】:
-
代码正在运行。您期望的输出是什么?我能找到的唯一小问题是
https:/facebook.github.io/react-native/movies.json它应该是https://fa -
这是
react-native项目还是react项目?
标签: reactjs api react-native react-router react-redux