Jhead45
4/25/2018 - 2:59 AM

fetch API in React.js

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 });
      });
  }