How to use fetch in react native

125 views Asked by At

i need help, i wanna get last 5 post from https://www.wired.com/category/security/ with react native but i dont know how i can do this, anybody help me, this is so important for me. i want to show on myscreen with flatlist, but i dont know how i can.

fetch(requestURL)
  .then((response) => response.json())
  .then((data) => {
    this.setState({
      data: data
    });
  })
  .catch((error) => console.log(error))
  .done();
0

There are 0 answers