How to async update field value depending on other fields?

I have the following form:
const defaultValues = {
    // (in my real scenario there are quite a few fields including arrays objects etc.)
    foo: '',
    bar: '',
    baz: '',
}

when any of the fields "foo" or "bar" changes, make a call to the API, show the loading and change "baz" with the API result

I thought about using
useQuery
because it already has isFetching, combined with
useEffect
to update and useStore to notify field changes but I don't know if it's the best way...
Was this page helpful?