fetch API in react.js in a componenetDidMountand set value to state
componentDidMount() {
fetch("https://ghibliapi.herokuapp.com/films")
.then(result => result.json())
.then(films => {
this.setState({ films });
});
}