DEV Community

Discussion on: Why you need to use React-Query in your React/React Native project

Collapse
 
benjamindaniel profile image
Benjamin Daniel

Hey, have you taken a look the rick and morty example, it does exactly what you are looking for, the Episode route handles that as it fetches the data for the episode with a unique id that depends on the episode's id, any subsequent load of that episode will only trigger silent refetch in the background, you can take a look at how the characters was prefetched for a more complex example. Does this help you?

Collapse
 
ausmurp profile image
Austin Murphy • Edited

Hey thanks! Following up, I converted our dashboard components to use react-query as they were the perfect candidates for it, and it is amazing. I still need to understand exactly how the keys work to refresh data when you pass an object as a key - assuming it's converted to a string under the hood. But it's working great.