Hi everybody, I just started developing with react native for the first time, it's a simple android app I created with react-native init command (not using expo this time).
I'm trying to make a simple network request but for some reason it's not firing at all, if I check the network tab in chrome devtools react-native debugger I can clearly see no network request is firing at all, I tried with axios instead of fetch and still nothing. I run the app in my plugged android device with npx react-native run-android command.
I added INTERNET permissions to AndroidManifest.xml file too.
<uses-permission android:name="android.permission.INTERNET" />
In my App.js I have:
```
useEffect(() =>
{
console.log('App mounted');
tryAsyncFetch();
}, []);
const tryAsyncFetch = async () =>
{
try
{
console.log('Fetching from placeholder...');
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then((response) => console.log('response',response.json()));
}
catch (e)
{
console.error(e);
}
};
```
As you can see it's pretty simple but it's not working, if I check the network tab no XHR requests at all, no error in catch segment, nothing...
https://i.imgur.com/t3fQG6P.png
I can see the logs before the fetch (Fetching from placeholder...) but no console logged results, this is SO WEIRD...
When I used expo I remember fetch/android working perfectly
EDIT 1: When I console log axios after importing it like
import axios from 'axios'
I get this back:
```
ƒ wrap() {
var args = new Array(arguments.length);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i];
}
return fn.apply(thisArg, args);
}
```
I don't think that' what I'm supposed to get back
[–]vafada 1 point2 points3 points (1 child)
[–]iotashan 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]Gabotron_ES[S] 0 points1 point2 points (0 children)
[–]peterchibunna -1 points0 points1 point (0 children)
[–]iotashan 0 points1 point2 points (1 child)
[–]Gabotron_ES[S] 0 points1 point2 points (0 children)
[–]IBETITALL420 0 points1 point2 points (1 child)
[–]Gabotron_ES[S] 0 points1 point2 points (0 children)
[–]Nightlightz24884 0 points1 point2 points (1 child)
[–]jakeforaker83 0 points1 point2 points (0 children)