0

I am building a react native app using expo and I am trying to connect to a http://localhost/api running on my localhost. All I ma getting is network error.

The expo app is running on a real device. I did that using expo start --localhost --android

I have tried using the ip address provided by the ipconfig /all instead of localhost but I am still getting Network Error

Here is my code

  const fetchApi = async () => {
try {
  const res = await axios.get("http://10.2.0.56:8000/");
  console.log(res.data);
} catch (error) {
  console.log(error.message);
}

};

Somebody please help

John Mark
  • 107
  • 7
  • Does this answer your question? [How can I access my localhost from my Android device?](https://stackoverflow.com/questions/4779963/how-can-i-access-my-localhost-from-my-android-device) – Abe Feb 16 '23 at 16:51

0 Answers0