I\'m using the fetch API in my react-native Android app to make requests to a local API. I usually query said API from react web apps at http://localhost:8163.
I\'m t
If you are using Metro Bundler in Expo Developer Tools Use CONNECTION LAN ip address Sample image Metro Bundler
How to used in react native
getfetch = () => {
return fetch('http://LAN-IP-ADDRESS-HERE:4300/customers/',{
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
}
})
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
})
.catch((error) =>{
console.error(error);
});
}
Sample image REST API using postman
Sample image POSTMAN
Hopefully this is helpful :)