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
Scot
Scot2y ago
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?
PTS
PTS2y ago
RTK query: ~ 19kB + React-Redux (peer) React Query: ~ 55.3kB ~ 13kB when using gzip At least that's what google result shows
Scot
Scot2y ago
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
PTS
PTS2y ago
no, wait, mb without redux toolkit that would be 19kB + React Redux (peer)
Scot
Scot2y ago
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
PTS
PTS2y ago
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?
cje
cje2y ago
try both and see which you like better
Scot
Scot2y ago
Not really, I just think the dx might be bad
PTS
PTS2y ago
sure thank you
Want results from more Discord servers?
Add your server