How do you debug React Native?

后端 未结 30 2732
无人共我
无人共我 2020-11-27 10:19

How does one debug their React code with React Native while the app is running in app simulator?

30条回答
  •  情歌与酒
    2020-11-27 10:23

    1. Run your app in simulator - react-native run-ios
    2. Press ctrl + d and click on Debug JS Remotely

    1. webpage should open up at http://localhost:8081/debugger-ui , if not type the URL and go to this link in Chrome
    2. Right click on the page and click Inspect and it should open the developer tools for chrome

    1. Go to the sources in the top menu and find your js class file in the right hand side file explorer

    2. You can put breakpoints to the view and debug the code in there as you can see in the image.

提交回复
热议问题