DEV Community

Discussion on: Redux vs Recoil: which should you use?

merri profile image
Vesa Piittinen • Edited on

Redux centralization is bad when you consider the amount of initial JS you need to load. It is hard to code split the centralized Redux store (if you have a large existing one). This means oftentimes all the code related to state changes are served on the initial JavaScript bundle. This can become an issue as once your JS grows too big it will start having an effect to people and their first impression of your site's performance is poor and may leave due to that.

Recoil does not suffer from this.

The good part about Redux store is the ease for providing initial state for hydration. Haven't used Recoil so I don't know if it is possible to do a SSR and share the resulting initial state to client.

emma profile image
Emma Goto 🍙 Author

That's an interesting point I hadn't thought about - it looks like there are ways to code split your Redux store but Recoil certainly does make it easier since you don't have to do any extra work to set it up.