Thanks for your work on reacto-form!
I currently have a scenario where one field is dependent on another—something roughly along the lines of a country and state/territory select, where changing the country should clear any previously selected state/territory value. The solution I came up with is:
- Create a
formRef with useRef() pointing to the latest object returned by useReactoForm()
- Call
setTimeout(countryDidChange, delay) whenever the country field onChange() event has fired
countryDidChange does something like formRef.current.getInputProps('state').onChange(null);
This works, but seems inelegant. I was wondering if this is something others had come across—and if so, is there a recommended pattern for handling these cases?