DEV Community

Cover image for ⚡🚀 ReactJS, TypeScript, Vite with Redux and TanStack (React Query) In Practice ⚛️

⚡🚀 ReactJS, TypeScript, Vite with Redux and TanStack (React Query) In Practice ⚛️

Truong Phung on November 13, 2024

1. Redux vs React Query (TanStack) Using Redux with Thunk and React Query (TanStack) together might seem redundant at first glance, but ...
Collapse
 
thomascogez profile image
Thomas.CA • Edited

Isn't the point of tanstack-query to "synchronize remote state", Imo managing remote state using a store while using tanstack-query is counter productive. Tanstack-query is avoiding you to write all those reducers logic for managing data, loading state etc ... In this context the store should only by used for global local states only (user preferences, ...)

Collapse
 
truongpx396 profile image
Truong Phung

hello Thomas, thank you for your feedback, I see your points, actually I think the combination of Redux with React Query (or Redux Toolkit Query) still makes sense in certain cases, especially in complex apps when we have to take care both complex client state (that isn't tied to server data) and server state (that needs automatic caching and refetching, keep it in sync...) :D

Collapse
 
philip_zhang_854092d88473 profile image
Philip

Integrating EchoAPI into my Redux workflow has greatly boosted both my development speed and the accuracy of API handling.

Collapse
 
truongpx396 profile image
Truong Phung • Edited

hello @philip_zhang_854092d88473 , thank you for your sharing, could you share me the link to EchoAPI that you mentioned, I'll come and have a look, thank you 😃

Collapse
 
philip_zhang_854092d88473 profile image
Philip

Hello! 😊 Thanks for your interest! You can check out EchoAPI through this link echoapi.com/. I hope you find it as useful as I have! If you have any questions about it, feel free to ask.

Thread Thread
 
truongpx396 profile image
Truong Phung • Edited

Thank you 😃

Collapse
 
xen1337 profile image
Sarfaraz Shaikh

thanks

Collapse
 
james_takahashi_77908481e profile image
James Takahashi

Great post.
👍🏻👍🏻👍🏻

Collapse
 
truongpx396 profile image
Truong Phung

thank you 😃

Collapse
 
rakesh_saini profile image
Rakesh Saini

Great post

Collapse
 
truongpx396 profile image
Truong Phung

thank you

Collapse
 
nambui98 profile image
Nam Bui

I think we don't need React Query when we integrate Redux Toolkit, as it has Redux Toolkit Query

Collapse
 
truongpx396 profile image
Truong Phung • Edited

Hello Nam, thank you for your feedback, you're right, when using Redux Toolkit, we have a RTK Query as a replacement for React Query, React Query is still particularly good for non-redux projects which prefer a lightweight, standalone library focused solely on server-state management. 😃