我正在使用独立的 React Native Debugger。它连接,但显示 redux 状态为未定义。我已经尝试了通过浏览互联网找到的所有版本。这种方法显示出更好的结果但有这个小问题
名为“Your Wallet”的值是变量 totalWallet,它从 redux 状态获取其值。
它正在工作,但调试器未显示此状态
我将提供者声明为
const App = () => {
return (
<Provider store={myStore}>
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerShown: false
}}
initialRouteName={'MainLayout'}
>
<Stack.Screen name="MainLayout" component={Tabs} />
</Stack.Navigator>
</NavigationContainer>
</Provider>
);
};
myStore 在哪里:
import { createStore, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import rootReducer from './stores/rootReducer';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const myStore = createStore(rootReducer, /* preloadedState, */ composeEnhancers(thunk));
rootReducer 是
import { combineReducers } from 'redux';
import tabReducer from './tab/tabReducer';
import marketReducer from './market/marketReducer';
import logReducer from './log/logReducer';
export default rootReducer = combineReducers({
tabReducer,
marketReducer,
logReducer
});
我会错过什么?
提前致谢
拉斐尔