微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

React Native 调试器不会显示我的 redux 状态,它会一直显示其他状态

如何解决React Native 调试器不会显示我的 redux 状态,它会一直显示其他状态

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

enter image description here

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

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

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,因为它是其他减速器的手动组合。我试图解决这个问题,但它没有。

在我的 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
            };

在这里遗漏了什么吗?

提前致谢

拉斐尔

解决方法

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。