I am using visual studio code IDE to develop react native app and am not using expo library.
Before that I was working on the android studio, debugging in that is straightforward and simple.
Now for react-native, I wanted to know how to debug my app using visual studio code IDE?
If you want to debug the app in VS Code itself, like in other IDEs. Then on approach can be to follow the following steps:
React Native Tools
Extension (provided byMicrosoft
) to VS Code.This is a nice add on to VS Code's capabilities for React Native.
If it initially says
No Configuration
then you can click on Add Configuration and then choose React Native option.Launch configuration
added, then you can click on Add Configuration button then you will see more options related to React Native.You can add configurations for
React Native: Attach to Packager
,React Native: Debug to Android
,React Native: Debug to iOS
in yourlaunch.json
file. It is present in.vscode
folder.Attach to Packager
.Debug JS Remotely
.Now your breakpoints should be working. Similarly if your app wasn't working already then you can go for
Debug Android
orDebug iOS
accordingly.Step1: Open app Setting in your mobile by shaking your mobile or by typing this command in your machine.
Step2: Select Debug JS Remotely which is the second option Step3: In your Browser type Url
http://localhost:8081/debugger-ui/
Step4: Again Open App Setting by shaking or running the command shown in step 1 and select Reload option which is first optionNow You can get all console logs in the browser and also you can debug your app remotely by putting breakpoints and analyze the values step by step.