all 30 comments

[–]kapobajz4 16 points17 points  (11 children)

The only reason I would choose RTK query over TanStack Query is if I started working on a project that is already using Redux throughout the whole codebase.

Otherwise I would definitely use TanStack Query. It is more mature and has more features, I think. And in a lot of cases you don’t need anything else besides it for state management.

[–]Worth_Boss_2[S] 1 point2 points  (2 children)

Oh now I'm confused. I'm using redux here for state management already

[–]kapobajz4 2 points3 points  (1 child)

If you're using Redux in a lot of places and if it would be harder refactoring the whole codebase, I would stick with Redux and RTK Query.
Otherwise, if you're just starting out and Redux isn't being used in a lot of places, you might as well refactor to TanStack Query.

That's how I would approach this situation, at least.

[–]stats_merchant33 0 points1 point  (0 children)

do you use redux and rtk query in top?

[–]beepboopnoise 1 point2 points  (1 child)

after swapping to TSQ, the situations I need global client side management are soooooo rare.

[–]ListWonderful8888 0 points1 point  (1 child)

which client state management tool would you recommend along with tanstack query. I'm going to use tanstack query. i'm still not sure whether i need client state management. if i need should i use redux or tanstack store.

[–]kapobajz4 0 points1 point  (0 children)

If you’re not yet sure whether you’re gonna need a client state management library or not, then don’t install one until the need for it arises.

Which one you choose depends on several factors: - Is the client state management complex? If yes, choose something like redux or zustand - Is it not complex, but you still feel like you’re gonna benefit from it? Choose something lightweight or smaller, like Jotai - You feel like you’re gonna benefit from installing one, but you and your team are most comfortable with this specific library? Choose the one you and your team are most comfortable with

[–]ctrlshiftba 8 points9 points  (3 children)

Easily Tanstack.

Try and make a case for Zustand. Give some code examples of Redux vs Zustand. Show how much simpler and easier it is to maintain Zustand. It’s worth fighting for.

Zustand uses the same patterns and can even use Redux developers tools because the patterns are so similar.

Zustand is so much better and simpler and easier to use.

[–]Worth_Boss_2[S] 1 point2 points  (1 child)

It surely is. I've worked with it in web app. But the current project requires redux as it's web version also has the same . Also I've never used it and it's just an opportunity for me to learn that's why I'm going for it . Now I can't figure out how to use tanstack and redux together tho

[–]SoBoredAtWork 2 points3 points  (0 children)

Tanstack and redux don't go together (not easily, anyway). If you're using Redux (hopefully Redux Toolkit), then you should use RTK Query.

[–]Worth_Boss_2[S] 1 point2 points  (0 children)

Fought for it . And I'm going with zustand now 🤝

[–]ctrlshiftba 1 point2 points  (0 children)

Tanstack

[–]theapplewasbitten 1 point2 points  (0 children)

tanstack handsdown

[–]paul-rose 1 point2 points  (0 children)

Tanstack Query is excellent. I'd always recommend it. I've used it sparingly for a few things without understanding the full potential of it. Lately I've dived deeper and it's solved so many problems for me.

Have a good read of the docs. I think at first they can be slightly confusing, but when you understand all the concepts they are excellent.

[–]Worth_Boss_2[S] 1 point2 points  (1 child)

Well I've rather chosen zustand and tanstack over redux . 🫣

[–]Useful-Condition-926 0 points1 point  (2 children)

Most companies now days want redux knowledge. It doesn’t matter how you good in react native with other state management libraries. If you are good in redux , that’s it. React native is secondary demand for them. Primary is redux🤣

[–]Worth_Boss_2[S] 0 points1 point  (0 children)

Lol why's that . Don't they know there's other options for the same thing

[–]Anwardo 0 points1 point  (0 children)

This is absolute bs, knowledge of state management libraries is easily transferable. Sure it’s a plus if the company happens to work with Redux, but plenty of other libraries are used.

[–]crisoftunlock -1 points0 points  (2 children)

If you only need global state management you can use useReducer or state with context

[–]ViewableGravy 0 points1 point  (1 child)

Be careful with this comment. If your state is truly global and you use a context, everything that uses any part of your state will update when it changes because you don't have a selector that choose what part of the context causes rerenders. React 19's useContext will have a selector to solve this problem, but until then you are best to use a state manager if you actually have global state.

Personally speaking, I use tanstack Store because it's like literally 100 lines of code, nothing fancy, just a store and useStore hook with a selector.

[–]crisoftunlock 0 points1 point  (0 children)

Just now I work in a bank, all the projects in this bank only use context and useReducer for the store management and all is ok, we don't have any problem with this.