Should we move over to react-query? #8507
Closed
shivankacker
started this conversation in
Ideas
Replies: 3 comments 1 reply
-
We could minimize the refactoring effort by reusing the const query = useQuery({
queryKey: ['patient', patientId],
queryFn: request(apiRoutes.getPatient)
}) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Having react-query being used would also make the code more familiar to more contributors. |
Beta Was this translation helpful? Give feedback.
0 replies
-
We've finally moved to tanstack query with #9360 |
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
-
https://www.npmjs.com/package/@tanstack/react-query
React Query is a powerful package for managing APIs with type safety, caching, infinite queries, and inbuilt state management.
It is almost the standard for managing APIs in react.
Why to move
One of the main reasons are developer experience, and ease of maintenance. Lets take an example using the current request component in our codebase
This includes states like loading and error that is very cumbersome to write and maintain.
Here is the same thing with react-query
Way easier to maintain and check for statuses.
There are a lot of such usecases that will reduce the complexity of our codebase significantly. The less state management the better.
Pros of migrating
cons
In the long run, it makes sense for us to switch over, and gradually deprecate the old hooks.
cc. @bodhish
Beta Was this translation helpful? Give feedback.
All reactions