Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async componentDidMount() {
  2.     try {
  3.       const res = await fetch('http://127.0.0.1:8000/api/');
  4.       const todos = await res.json();
  5.       this.setState({
  6.         todos
  7.       });
  8.     } catch (e) {
  9.       console.log(e);
  10.     }
  11.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement