【问题标题】:React Native Debugger: why can't I put a breakpoint at this point in my Redux saga?React Native Debugger:为什么我不能在我的 Redux 传奇中设置断点?
【发布时间】:2020-08-31 22:44:45
【问题描述】:

我在 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】:

    把你的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))
       }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-05
      • 1970-01-01
      • 2016-09-01
      • 2021-04-17
      • 2019-01-23
      • 1970-01-01
      相关资源
      最近更新 更多