Issues when attempting to fetch data upon clicking select field options #10869
Unanswered
MonaAghili
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using React Query to retrieve data for two select fields. The first select field is populated with data using the
useQuery
hook, and the second select field's options depend on the selected value of its sibling. When a new option is selected in the first field, auseMutation
is triggered, sending a request to the server. If the request is successful, the resulting data is then displayed in the second field.this is what my component look like : https://codesandbox.io/s/lingering-leftpad-jl4l5m?file=/src/FormComponent.js
the
handleCityChange
will never trigger and send request to API because of{...register("city")}
What should we do for scenarios like this?
Beta Was this translation helpful? Give feedback.
All reactions