![](/img/trans.png)
[英]No location change upon connected-react-router push() from within the react-redux connect()
[英]Can't resolve module 'react-redux' in connected-react-router with react-redux and redux modules installed
我正在尝试使用connected-react-router
模块。
从文档中,这是我在reducer中的代码:
import { combineReducers } from 'redux';
import login from './loginReducer';
import { connectRouter } from 'connected-react-router'
export default (history) => combineReducers({
router: connectRouter(history),
login
});
我在编译时遇到此错误:
./node_modules/connected-react-router/esm/ConnectedRouter.js找不到模块:无法在'C:\\ Users \\ ericn \\ Documents \\ ReactJS \\ test \\ node_modules \\ connected-react-router中解析'react-redux' \\ esm'
我已经寻找了一段时间,但似乎没有一个问题。
有什么想法吗?
我最近遇到了类似的错误。 我意识到我忘了添加react-redux
作为对我项目的依赖,我只添加了react
。
因此,请确认您的package.json中已包含react-redux
并将其安装在node_modules中。 如果没有,您可以运行:
npm install --save react-redux
// or if you are using yarn
yarn add react-redux
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.