Search code examples
redux-formadmin-on-rest

How to react to changes in SimpleForm Inputs?


I'm making a custom input component that needs to change when other input values are changed in the form.

<ReferenceInput source="foo">
  <SelectInput />
</ReferenceInput>
<NumberInput onChange={(e, newValue) => {this.setState({ newValue })} />
<CustomInput numberValue={this.state.newValue} />

When NumberInput changes, I can pass CustomInput the new value. But ReferenceInput / SelectInput doesn't have an onChange. How do I get the new value of SelectInput to the CustomInput? (Note that inside CustomInput, props.record.foo doesn't update when ReferenceInput changes.)


Solution

  • Check out aor dependent input

    https://github.com/marmelab/aor-dependent-input