尝试从“ redux-form”导入reducer时出错

时间:2018-12-05 16:08:35

标签: redux-form

他的应用运行正常,从redux-form导入reducer并添加到合并的reducer中,出现此错误,我在网络上找不到解决方案。

import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'

import App from './components/App'
import reducers from './reducers'

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(
  reducers,
  composeEnhancers(applyMiddleware(thunk))
)

ReactDOM.render(
  <Provider store={store}>
  <App />
  </Provider>,
  document.querySelector('#root')
)


import { combineReducers } from 'redux'
import authReducer from './authReducer'
import {reducer} from '../../node_modules/redux-form/lib/reducer'

export default combineReducers({
  auth: authReducer,
  form: reducer,
})

withRef已删除。要访问包装的实例,请在连接的组件上使用ref

1 个答案:

答案 0 :(得分:0)

我通过修复package.json中的react-redux版本解决了这个问题

将“ react-redux”:“ ^ 6.0.0”更改为“ react-redux”:“ ^ 5.1.1”