How can I change value of specific field on event.
Example not working (Cannot read property 'firstname' of undefined)
onclick1() {
this.props.fields.firstname.onChange("John")
}
render() {
const { handleSubmit } = this.props;
return (
<div>
<form onSubmit={handleSubmit(this.submit.bind(this))}>
<Field
name="firstname"
component={TextField}
label="first name"
/>
<button onClick="this.onclick1()">Set name to John</button>
<button type="submit">
okay
</button>
</form>
This solution was proposed here but it is not working for me https://stackoverflow.com/a/36916183/160059
redux-form v7