[英]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.