Answers for "how to fetch an api in react js"

4

How to fetch data from an api react

const fetchData = () => {
return fetch("https://randomuser.me/api/")
      .then((response) => response.json())
      .then((data) => console.log(data));}
Posted by: Guest on June-07-2021
19

fetch api javascript

fetch('http://example.com/movies.json')
  .then((response) => {
    return response.json();
  })
  .then((myJson) => {
    console.log(myJson);
  });
Posted by: Guest on February-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language