DEV Community

Discussion on: Five Clever Hacks for React-Query or SWR

Collapse
 
ecyrbe profile image
ecyrbe • Edited

Thank you jack. Big fan of your work.

Keep it up. Especially on micro front-end content. That's how i got to know you.

I'll add some tips, for react query users.
You can now use persistance with react query, this means... You can also serve offline apps for cheap.

You can also use complex keys when they are parameters of your fetch function. Don't be affraid to use objects or arrays in your keys. React query will this way be able to track parameters change and refetch for you when parameters are changing.

Also if you need to force a refetch but don't want to invalidate cache (because this would mean resetting load state). Use query has a refetch helper you can get back from useQuery call.