'How to replace input value using redux-form ? React
I using redux-form to get value from input ->
<Field
id="primary-color"
name="theme.primaryColor" <- How to get value
component={ButtonColorPicker}
label={intl.formatMessage(messages.primaryColor)}
/>
And this is work good but,
I want to replace this theme value sometimes.
I have dropdown when I want to change value ->
<Field
id="colorDropdown"
name="colorDropdown"
component={renderColorDropdown}
options={options}
onChange={this.selectedColors}
/>
selectedColors is function
selectedColors = (colors) => {
let { theme, formValuesTheme } = this.props;
console.log("colors", colors);
};
I got good results but I want if not selected anythink i need to set:
<Field
id="primary-color"
name="theme.primaryColor" <- How to get value
component={ButtonColorPicker}
label={intl.formatMessage(messages.primaryColor)}
/>
But if is changed dropdown to set selected ->
<Field
id="primary-color"
name="NEW_SELECTED_VALUE" <- How to replace old value with new selected
component={ButtonColorPicker}
label={intl.formatMessage(messages.primaryColor)}
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
