我只是想知道是否仍然可以使用MoviesDB中的访存API发布数据。我能够将信息发布到控制台。但是现在我想在我的React Page上实际渲染。这是下面的代码。任何帮助表示赞赏。谢谢!
import React, {Component} from 'react';
import './App.css';
class Home extends Component{
constructor(props) {
super(props);
}
getPost = () => {
return fetch("https://api.themoviedb.org/3/movie/550?api_key=54a83919a7f93d82a8b8bdd417544d6f")
.then(res=>res.json())
.then(posts => console.log(posts))
}
render() {
return (
<div className="App">
<div className="headings">
<img className="LOGO" src="https://www.moonlight.com.au/wp-content/themes/moonlight-2016/dist/images/moonlight-logo.png" alt="back"/>
<input className="input"
placeholder="Enter a movie title" />
<button onClick={this.getPost}>Get post</button>
</div>
</div>
);
}
}
export default Home;