react-native - 反应原生 Redux-DevTools-Extension 不起作用
问题描述
我在用着 :
"react-native": "0.63.3",
"react": "16.13.1",
"react-redux": "^7.2.2",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0"
这就是我的 redux 商店的样子:
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: ['auth', 'user', 'whiteCommonData'], //only navigation will be persisted
};
const initialState = {};
const middleWare = [thunk];
// if (process.env.NODE_ENV !== 'production') {
// middleware.push(createLogger());
// }
middleWare.push(createLogger());
const persistedReducer = persistReducer(persistConfig, rootReducer);
// const composeEnhancers = composeWithDevTools({
// // Specify name here, actionsBlacklist, actionsCreators and other options if needed
// });
const composeEnhancers =
(typeof window !== 'undefined' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose;
export const store = createStore(
persistedReducer,
// undefined,
composeEnhancers(applyMiddleware(...middleWare)),
);
export const persistor = persistStore(store);
我阅读了文档并按照它所说的做了一切,但我无法让它工作,并且 chrome 扩展没有显示 redux 状态。
我从redux-devtools-extension ducimentation尝试了 soultion 1.1 和 1.3,但没有任何改变。我也读过这个、这个和这个,但没有一个是有帮助的。我怎样才能让它工作?
解决方案
我无法让它工作。我尝试了 react-native-debugger并且效果很好。
这是我的 store.js :
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: ['auth', 'user', 'whiteCommonData'], //only navigation will be persisted
};
const initialState = {};
const middleWare = [thunk];
// if (process.env.NODE_ENV !== 'production') {
// middleware.push(createLogger());
// }
middleWare.push(createLogger());
const persistedReducer = persistReducer(persistConfig, rootReducer);
// const composeEnhancers = composeWithDevTools({
// // Specify name here, actionsBlacklist, actionsCreators and other options if needed
// });
const composeEnhancers =
(typeof window !== 'undefined' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose;
// const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export const store = createStore(
persistedReducer,
// undefined,
composeEnhancers(applyMiddleware(...middleWare)),
);
export const persistor = persistStore(store);
推荐阅读
- c++ - C++ 类成员指针
- java - 如何从 Android 中的 Cloud Firestore 中检索自定义对象列表
- reactjs - 运行 npm run build 时出现错误 -Module Build Failed postcss-loader
- snowflake-cloud-data-platform - SQL 编译错误:提供 Azure 存储端点“Azure_StorageAccount.Queue.Core.Windows.Net.” 目前不支持
- d3.js - D3 线图 - 线未在正确的坐标处绘制
- javascript - 当 swiper 幻灯片处于活动状态时使用动画更改 css - Slider Swiper
- python - xarray.open_rasterio 不能在列表理解中打开超过 ~400 个文件
- node.js - mongodb 未知顶级运算符:$function nodejs
- javascript - How to creata multiple radio button selection? HTML Javascript
- javascript - 为什么从“..”父索引文件的相对导入会导致异步模块解析行为?