簡體   English   中英

React Native Debugger:為什么我不能在我的 Redux saga 中設置斷點?

[英]React Native Debugger: why can't I put a breakpoint at this point in my Redux saga?

我在 Redux 傳奇中有以下代碼:

function* providersList(action) {
    yield put(LoadingActionCreators.start(Actions.PROVIDERS_LIST));
    yield put(ErrorActionCreators.clear(Actions.PROVIDERS_LIST));

    try {
        const response = yield call(
            PostRequest,
            'providers/list',
            {
                AuthorizationKey: authorizationKey,
                CustomerID: action.customerID
            }
        );
        if (response.Message === "Success")
            yield put(ProvidersActionCreators.providersListSuccess(response.Providers))
        else
            yield put(ErrorActionCreators.set(Actions.PROVIDERS_LIST, new Error('PROVIDERS_LIST ERROR')));
    } catch (error) {
        yield put(ErrorActionCreators.set(Actions.PROVIDERS_LIST, error));
    }
    yield put(LoadingActionCreators.end(Actions.PROVIDERS_LIST));
}

我正在使用 React Native 調試器,並且想在if (response.Message === "Success")行放置一個斷點。 調試器不會讓我這樣做。 如果我單擊將斷點放在那里,它會將其放在function* providersList(action)行的上方。

誰能幫我理解這是為什么?

以這種方式放置您的debugger並從developer menu中啟用debug並打開console of chrome debugger

if (response.Message === "Success"){
       debugger       // you have to add this line.
       yield put(ProvidersActionCreators.providersListSuccess(response.Providers))
   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM