DEV Community

Cover image for Connect to react-native server using ADB reverse.
a c sreedhar reddy
a c sreedhar reddy

Posted on

Connect to react-native server using ADB reverse.

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. 🙂

Top comments (0)