【问题标题】:React native debugger won’t show my redux state, it keeps showing other statesReact 本机调试器不会显示我的 redux 状态,它会一直显示其他状态
【发布时间】:2021-08-31 12:52:57
【问题描述】:

我希望 react-native 调试器显示我的 redux 状态,但它一直显示很多其他状态

调试器的其他部分工作正常

我配置商店的方式是这样的:

import { compose, createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { superReducer } from './superReducer';

const middleware = [thunk];
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

function configStore() {
    return createStore(superReducer, composeEnhancers(applyMiddleware(...middleware)))
};

export default configStore

我将它命名为 superReducer,因为它是其他 reducer 的手动组合。我这样做是为了解决这个问题,但它没有。

在我的 App.js 中我这样做:

const myStore = configStore()

const App = () => {
    return (
        <Provider store={myStore}>
            <NavigationContainer>

而superReducer的声明方式是:

const initialState = {
    logNumber: 0,
    myHoldings: [],
    coins: [],
    error: null,
    loading: false,
    isTradeModalVisible: false
};

export const superReducer = (state = initialState, action) => {
    switch (action.type) {
        case logActionTypes.SET_LOG_NUMBER:
            return {
                ...state,
                logNumber: action.payload
            };

我错过了什么吗?

提前致谢

拉斐尔

【问题讨论】:

    标签: reactjs react-native react-redux react-native-debugger


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2019-01-19
      • 2019-04-07
      • 2020-07-26
      • 2021-08-04
      • 1970-01-01
      • 2021-03-19
      • 2021-07-17
      • 1970-01-01
      • 2019-01-18
      相关资源
      最近更新 更多