Connect React Native app with localhost backend server
Nov 10, 2022
To run the React-Native app on the local backend server you need to do the below configurations:
- Run command:
$ adb -s <emulator_device_id> reverse tcp:<localhost_port> tcp:<localhost_port>
example:$ adb -s 24571182 reverse tcp:3000 tcp:3000
- Configure localhost API:
- Android:http://10.0.2.2:3000
- iOS:http://localhost:3000
- Connected!
Still not able to connect?
Try replacing localhost with your computer IP address.
example: http://<YOUR_IP_ADDRESS>:3000