score:1

const [data, setData] = useState([]);

  useEffect(() => {
    fetch('https://jsonplaceholder.typicode.com/posts')
      .then((response) => {
        return response.json();
      })
      .then(myJson => {      
        setData(myJson);
      });
  }, []);

Related Query

More Query from same tag