Я пытаюсь использовать redux-form
// rootRedcer.ts
import { combineReducers } from 'redux'
import { reducer as formReducer } from 'redux-form'
import translation from './translation/reducer'
export default combineReducers({
form: formReducer,
translation,
})
// components/DashboardHome/index.tsx
import { connect } from 'react-redux'
import DashboardHome from './Home'
export default connect()(DashboardHome)
// components/DashboardHome/DashboardHome.tsx
import * as React from 'react'
import { Field, reduxForm } from 'redux-form'
function handleSubmit(value) { console.log(value) }
const DashboardHome = () => (
<form onSubmit={handleSubmit}>
<div>
<label htmlFor="firstName">First Name</label>
<Field name="firstName" component="input" type="text" />
</div>
<div>
<label htmlFor="lastName">Last Name</label>
<Field name="lastName" component="input" type="text" />
</div>
<div>
<label htmlFor="email">Email</label>
<Field name="email" component="input" type="email" />
</div>
<button type="submit">Submit</button>
</form>
)
export default reduxForm({
form: 'registration'
})(DashboardHome)
Но я получаю ошибку
Failed prop type: The prop `fields` is marked as required in
`ReduxForm(DashboardHome)`, but its value is `undefined`.
В чем причина ошибки? Что я делаю не так?
Спасибо