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.