Debugging React Native Applications with React Native DevTools
A reliable debugging workflow starts with reproducing the problem, not with adding more console.log calls. React Native DevTools brings JavaScript debugging, component inspection, and performance tools into one place for apps running the Hermes runtime.
This guide walks through a repeatable approach you can use for everyday issues.
Open React Native DevTools
Start your development server and launch your app in a development build or native debug build.
For Expo:
npx expo start
Press j in the Expo CLI terminal when the app is connected and supports React Native DevTools. For React Native CLI projects, use the DevTools shortcut provided by your Metro terminal. The exact command may differ by tooling version.
React Native DevTools targets the supported Hermes debugging environment. It is not a substitute for Xcode or Android Studio when you are investigating native crashes or build failures.
Start with a reproducible case
Before opening a breakpoint, write down:
- The screen and action that triggers the bug.
- Whether it occurs on iOS, Android, or both.
- Whether it occurs in development, releases, or both.
- The expected behavior and what actually happened.
A clear reproduction turns a vague report into a question you can test.
Inspect a component's props and state
Use the component inspector to locate the element involved. Confirm the props, current state, and component hierarchy before changing any code.
For example, a Pressable that appears disabled may be receiving an unexpected disabled value from its parent. The inspector helps distinguish a state bug from a touch-area or layout issue.
Debug JavaScript with breakpoints
Open the Sources panel and set a breakpoint in the handler that runs when the problem occurs.
async function saveProfile() {
setSaving(true);
try {
const response = await fetch('https://api.example.com/profile', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ displayName }),
});
if (!response.ok) {
throw new Error(`Save failed: ${response.status}`);
}
} finally {
setSaving(false);
}
}
Pause at the fetch call. Inspect displayName, continue to the response, and verify that the finally block resets the loading state even after a failure.
Avoid copying real authentication tokens or personal information into shared logs while debugging.
Use the console with intent
Prefer narrow messages that explain a specific transition:
console.debug('Profile save requested');
console.warn('Profile save rejected', { status: response.status });
Do not log full network headers, passwords, or token values. Remove verbose debug output before shipping.
Examine slow interactions
When a screen feels slow, record the interaction using the available performance/profiling tools in your installed DevTools version. Look for unnecessary renders, expensive JavaScript work, and large lists rendering more items than required.
For a list, measure before adding useMemo or React.memo. Performance optimizations help only when they address a real bottleneck.
Test appearance without changing device settings
React Native 0.86 adds light/dark appearance emulation through the DevTools command palette (Cmd/Ctrl + Shift + P). This is useful when validating theme-aware colors and conditional UI. The emulation is temporary and resets when DevTools disconnects.
When DevTools is not enough
- Native crash or build failure: use Xcode or Android Studio logs and native debugging tools.
- Network behavior: inspect status codes, request payloads, and backend logs; DevTools support varies by setup.
- Release-only issue: reproduce with a release-like build, crash reporting, and matching source maps where available.
- Layout under system bars or keyboard: test on physical devices and multiple Android navigation modes.
A small debugging routine
Reproduce, inspect, form a hypothesis, add a breakpoint, change one thing, and retest. Keep a short note of the root cause so the same issue is easier to recognize later.