React Native Debugger:为什么不能在Redux传奇中此时放置一个断点?

问题描述 投票:0回答:1

我在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)行上方。

任何人都可以帮助我了解这是为什么吗?

reactjs react-native redux redux-saga react-native-debugger
1个回答
0
投票

以这种方式放置debugger并从debug中启用developer menu并打开console of chrome debugger

if (response.Message === "Success"){
       debugger       // you have to add this line.
       yield put(ProvidersActionCreators.providersListSuccess(response.Providers))
   }
© www.soinside.com 2019 - 2024. All rights reserved.