1
我試圖讓我與V6 Redux的形式創建的形式在我的應用程序組件呈現在瀏覽器中顯示。不過,我得到以下錯誤:V6終極版形式,reduxForm()mapDispatchToProps返回錯誤
Uncaught Error: `mapDispatchToProps` must return an object. Instead received function() {
return computedActions;
}.
我LoginForm的組件:
import React, { Component } from 'react'
import { reduxForm, Field } from 'redux-form'
class LoginForm extends Component {
render() {
return (
<form>
<div>
<label htmlFor="email">Email</label>
<Field
name="email"
component="input"
type="text"
/>
</div>
<div>
<label htmlFor="password">Password</label>
<Field
name="password"
component="input"
type="password"
/>
</div>
<button type="submit">Login</button>
</form>
)
}
}
export default reduxForm({ form: 'login' })(LoginForm)
App.js進口LoginForm的組件:
import React from 'react'
import LoginForm from '../containers/LoginForm'
export default() =>
<div>
<LoginForm />
</div>
我頂層index.js:
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { BrowserRouter, Route } from 'react-router-dom'
import reducers from './reducers'
import configureStore from './store/configureStore'
import App from './components/App'
const store = configureStore()
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,
document.getElementById('root'))
相關DEPE相關內容:
"react-dom": "^0.14.3",
"react-redux": "4.0.0",
"react-router-dom": "^4.1.1",
"redux": "^3.0.4",
"redux-form": "^6.6.3"
任何對解決方案的洞察力都非常感謝!