问题描述
我希望 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,因为它是其他减速器的手动组合。我试图解决这个问题,但它没有。
在我的 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
};
我在这里遗漏了什么吗?
提前致谢
拉斐尔