I am creating a custom component for my form.
What I want: after I clicked a specific place in my onClick handler, I can set the appropriate value for the form field.
How to do it?
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 that it’s a kind of hack.
The best solution?
Note. I also asked this question on the problem page for redux-form: https://github.com/erikras/redux-form/issues/369
reactjs redux
songyy
source share