DEV Community

loading...
Cover image for Connect to react-native server using ADB reverse.

Connect to react-native server using ADB reverse.

acsreedharreddy profile image A C SREEDHAR REDDY ・1 min read

Add this connect script to your package.json.

{
...
"scripts": {
   ...
    "connect": "adb reverse tcp:8081 tcp:8081 && adb reverse tcp:8097 tcp:8097"
  }
}

Enter fullscreen mode Exit fullscreen mode

When you connect your physical device while developing a react native app, sometimes you might remove the USB to use your phone.

Now to connect it back you would generally run npm run android which might take some time.

Instead, you could run npm run connect which would reverse the ports 8081 and 8087. This would take far less time when compared to npm run android.

And you can continue your development. 🙂

Discussion (0)

pic
Editor guide