问题
I have a custom component which renders two values, mainOkved
as a string and additionalOkveds
as an array. In order to use it without react-final-form
I simply add these values to the state and update them onSelect
:
onSelectOkved(mainOkved, additionalOkveds) {
this.setState({
mainOkved: mainOkved,
additionalOkveds: additionalOkveds
});
}
The component itself looks like this:
<OkvedSelector mainOkved={this.state.mainOkved} additionalOkveds={this.state.additionalOkveds} onSelect={this.onSelectOkved} />
How can I implement this component with react-final-form
? Should I use mutators or it can be done with a Field?
来源:https://stackoverflow.com/questions/57901348/how-to-implement-a-custom-component-with-two-values-in-react-final-form