the getting started page says:
import { createstore, combinereducers } 'redux' import { reducer formreducer } 'redux-form' const reducers = { // ... other reducers here ... form: formreducer // <---- mounted @ 'form' } const reducer = combinereducers(reducers) const store = createstore(reducer)
but reduxform() documentation says:
form : string [required]
the name of form , key form's state mounted under redux-form reducer
i running simple form example. have code:
var reduxformreducer = reduxform({ formkey: 'personal' // unique identifier form })(simpleform); var reducer = combinereducers({ formkey: reduxformreducer });
but shows error:
warning: failed prop type: required prop
form
not specified inform(simpleform)
. in form(simpleform) (created connect(form(simpleform)))
i've tried this:
var reduxformreducer = reduxform({ form: 'formkey' // unique identifier form })(simpleform); var reducer = combinereducers({ formkey: reduxformreducer });
it doesn't show error edit fields empty , can't change.
i hope missed in reducer, please use key name form
var reduxformreducer = reduxform({ form: 'formkey' // unique identifier form })(simpleform); var reducer = combinereducers({ form: reduxformreducer // <- change formkey form here });
refer: http://redux-form.com/6.0.2/docs/gettingstarted.md/
update:
the form reducer. should given mounted redux state @ form
.
if absolutely must mount somewhere other form
, may provide getformstate(state)
function reduxform()
decorator, slice of redux state have mounted redux-form
reducer.
Comments
Post a Comment