React Native使用redux-devtools-extension提示No store found问题求助
Redux DevTools 识别失败 No store found 问题排查
问题现象
- React Native应用运行时弹出 No store found 报错,调试工具无法识别应用内的Redux store实例
- 已完成Redux store初始化、安装
redux-devtools-extension依赖用于状态树追踪,但调试工具始终无法建立连接
现有实现代码
import { createStore, combineReducers, applyMiddleware } from 'redux'; import { composeWithDevTools } from 'redux-devtools-extension'; import authReducer from './store/reducers/auth'; const rootReducer = combineReducers({ auth: authReducer, }) const store = createStore(rootReducer, {}, composeWithDevTools( applyMiddleware(ReduxThunk), ));
已安装的依赖版本
"react-native-debugger-open": "^0.3.25", "redux-devtools-extension": "^2.13.9", "react-redux": "^7.2.3", "redux": "^4.0.5", "redux-thunk": "^2.3.0"
问题定位与修正方向
- 补全缺失的导入逻辑:现有代码中直接引用了
ReduxThunk,但未在文件头部添加对应的导入语句,会在store初始化阶段触发引用错误,导致store实例无法正常创建,最终触发"No store found"。需要新增import ReduxThunk from 'redux-thunk'的导入语句。 - 校验store全局挂载:即使store初始化逻辑正常,如果未通过
react-redux的Provider组件包裹应用根节点、将store作为prop传入,调试通道无法触达全局store实例,自然无法完成识别。 - 确认调试链路连通:React Native场景下,
redux-devtools-extension的连接依赖调试进程的端口映射,需要确认调试进程正常启动、无端口占用或网络代理阻断连接,react-native-debugger-open对应的Redux调试面板处于可连接状态。 - 校验store创建参数:当前依赖版本的兼容性无冲突,
composeWithDevTools的参数嵌套逻辑不存在本质问题,仅需确认初始化的默认状态对象无格式错误,不会阻断store初始化流程。
内容的提问来源于stack exchange,提问作者Renan Bronchart
相关产品推荐
相关产品推荐

