I'm creating a customised component for my form.
What I want: after I click a certain location, in my onClick handler, I can set the corresponding value for the form field.
How to do that?
My current solution:
_onClick(value, evt) {
const {field, dispatch} = this.props
if(dispatch){
dispatch({type: "redux-form/CHANGE", field: field.name, value: value, touch: false, form: field.form})
}
}
it doesn't work yet.. but even if it works, I feel this is kind of hack.
Any better solution?
Note: I also asked this question on the issue page for redux-form: https://github.com/erikras/redux-form/issues/369
off-topicis supposed to be used. This shouldn't be closed.