<FormSpy subscription={{ values: true }}>
{({ values, form }) => {
if (values.departamentoNacimiento !== idDepartamento)
{
setIdDepartamento(values.departamentoNacimiento)
form.change('municipioNacimiento')
}
return null; }}
</FormSpy>
my code is obove can anyone help me. I have tried to solve it, but nothing is working. i got this Warning: Cannot update a component (Form) while rendering a different component (FormSpy). To locate the bad setState() call inside FormSpy
I try use formSpy also as an callback but form.change is not working.
<FormSpy subscription={{ form: true }}
onChange={props => {props.form.change('municipioNacimiento')}} />