React Native Debugging with Async/Await
I see this problem whenever i set a breakpoint after the use of an await operator.
For example you could have a function:
static async makeRequest(request) { // Breakpoints here work fine request.method = 'GET' // Breakpoints not working anymore because of the await operator const response = await fetch(request); const obj = await response.json(); obj.debug = true; return obj;}
Putting a breakpoint after one of the await operators does not work.However, setting a breakpoint before the await operator seems to work fine.
To get around this issue I found that delegating into other functions allow you to put breakpoints. So I would change this to:
static async makeRequest(request) { request.method = 'GET' const response = await fetch(request); const obj = await response.json(); return doSomething(obj);}static doSomething(obj) { // Putting breakpoints here works fine obj.debug = true; return obj;}
One of my co-workers solved this by using react-native-debugger