TanStackT
TanStack3y ago
3 replies
progressive-amaranth

React Query vs React's Context API

Hey folks,

I'm using React Query in a project and the idea is to use this in place of context providers. However, my question is, whether having both in a project is suitable? I understand they have different purposes, but it would be great if someone could outline when you would use one over the other (or use both for that matter).

Also, I have an example where I feel like using React Query is overkill, but would appreciate some feedback. The issue is, there is a page where a user selects an option in a dropdown and clicks on a button to continue their journey. I use the
useState
hook and the context API to store the value of the dropdown, in order to access it on the following pages.

In this instance, would I be able to do this using React Query?
Was this page helpful?