Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16899

react native fetch api or axios cause Network request failed

$
0
0

I already checked all the similar problems but none help me and also most of them haven't an accepted answer. also i checked RN docs but no luck.here is my code to fetch data from an api:

  useEffect(() => {    fetch('https://jsonplaceholder.typicode.com/users')      .then((res) => res.json())      .then((data) => { alert(data) })      .catch((err) => console.log(err))  }, []);

also I tried axios , same result.

no matter what link i use, it always throw me [type error: Network request failed] .I want to know what is the cause of this not a hacky way to solve.


Viewing all articles
Browse latest Browse all 16899

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>