RTK Query (with no redux) or React Query?
I'm a noob, obviously, but a bunch of my friend called me out for making api requests in useEffect and they recommended me to use RTK query instead. The problem is that I'm not planing on using redux in my project, since its way too small for that.
So... should I go with RTK query (with no redux) or with React Query instead?
Just please elaborate a bit because I want to understand why, not just blindly follow. Huge thanks <33
9 Replies
I don't think it makes much sense to use rtk query if you're not using redux, is there a massive difference in bundle size?
RTK query:
~ 19kB + React-Redux (peer)
React Query:
~ 55.3kB
~ 13kB when using gzip
At least that's what google result shows
How the fuck is react query so big, and people still give redux a hard time jesus,
That redux size must be gzipped as well
no, wait, mb
without redux toolkit that would be 19kB + React Redux (peer)
Ah it has a bunch if dependencies, not too much but still eh.
I'd still use react query since its designed for that, rtk query assumes your using redux
but is there any more reasons to not use rtk query like that? besides bundle size and "thats not designed for that"? is there any massive performance, security issues with one of these?
try both and see which you like better
Not really, I just think the dx might be bad
sure thank you