Programmatically change Redux-Form Field value Programmatically change Redux-Form Field value reactjs reactjs

Programmatically change Redux-Form Field value


You can have the onChange logic in this.handleSelectChange({ value, type: input.name }) and use change action from redux-form

According to the docs:

change(field:String, value:any) : Function

Changes the value of afield in the Redux store. This is a bound action creator, so itreturns nothing.

Code:

import { change } from "redux-form";handleSelectChange = (value, type) => {  if (type === "site") {    this.props.change('net', "newValue");  }}const mapDispatchToProps = (dispatch) => {  return bindActionCreators({change}, dispatch);}