u/raju_gupta

How do you debug in React Native? I made a walkthrough of breakpoints, stepping and Watch in DevTools
▲ 8 r/react+2 crossposts

How do you debug in React Native? I made a walkthrough of breakpoints, stepping and Watch in DevTools

I used to debug almost everything with console.log, and it cost me a lot of time. Once I started using breakpoints in React Native DevTools, finding bugs got much faster.

Here's the short version of what helped me:

- Breakpoints pause your app at an exact line, so you can inspect the real values at that moment instead of guessing which logs to add

- Stepping (step over / step into / step out) lets you follow the code line by line and see where it goes wrong

- Watch lets you track specific variables or expressions as the code runs, without adding a log for each one

- Different breakpoint types are useful in different situations, for example when a bug only happens under a certain condition

I recorded a video that explains why breakpoints are worth using and shows each of these live in React Native DevTools:

https://youtu.be/NexWmQN5gY8

I'm getting back into making videos after a long break, so I'd really like honest feedback.

Question for everyone: what's your debugging setup in React Native? Do you use DevTools breakpoints, Flipper, console.log, or something else? And is there a debugging topic you'd like me to cover next?

u/raju_gupta — 4 days ago