How to refetch useQuery with different params without using state? #4076
Unanswered
shubhamak2
asked this question in
Q&A
Replies: 1 comment
-
please see my stackoverflow comment: https://stackoverflow.com/questions/73473495/react-query-how-to-refetch-usequery-with-different-params-without-using-state |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Hi Guys,
I have one issue with fetching the data using the useQuery. Please have a look at the code below:
FetchUser hook:
Users component:
School component:
Some notes:
School component: Here, we are rendering the school names and when the user selects any school data, we are calling updateUsersData method and from this method, we have to call again the useFetchUsers hook with updated params but it is not working.
I don't want to take additional states i.e selectedSchool and selectedYear on Users component because of unnecessary component rendering.
Problem: How to again call useFetchUsers hook with updated params from updateUsersData method?
Beta Was this translation helpful? Give feedback.
All reactions