I am practicing fetching data from APIs and with Fetch in Reactjs and on Codesandbox.io
The problem that sometimes I get the data and sometimes not. Here is a working example, it prints data to my console
componentDidMount() {
fetch("https://www.reddit.com/r/redditdev/top.json")
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => console.error(error));
}
For this url it works (also with https://api.github.com/orgs/nodejs), but if I change the url to "https://www.cryptocompare.com/api/data/coinlist/" or "https://chasing-coins.com/api/v1/std/coin/BTC" it doesn't work.