Connect React Native app with localhost backend server

--

To run the React-Native app on the local backend server you need to do the below configurations:

  1. Run command:
    $ adb -s <emulator_device_id> reverse tcp:<localhost_port> tcp:<localhost_port>
    example:
    $ adb -s 24571182 reverse tcp:3000 tcp:3000
  2. Configure localhost API:
    - Android: http://10.0.2.2:3000
    - iOS: http://localhost:3000
  3. Connected!

Still not able to connect?

Try replacing localhost with your computer IP address.

example: http://<YOUR_IP_ADDRESS>:3000

--

--

Chanchala Gorale
Chanchala Gorale

Written by Chanchala Gorale

Founder | Product Manager | Software Developer

Responses (1)