-
Notifications
You must be signed in to change notification settings - Fork 4
Use Immutable.js #2
Comments
Hi @alexsegura What about using: https://github.com/leoasis/redux-immutable-state-invariant? |
Thank you for your comment. It says "For development use only". The goal to use Immutable.js is to avoid having to clone arrays for example |
Yes you are right, you would still need to clone your array. You should have a look at http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html to prevent that |
Immutable.js is great, but this is adding yet another Facebook library 😐 |
Hi guys, great project. I had a quick look at the reducers and I don't think there is any need for cloning or deep cloning objects. One usual way to do it is to store objects by their ids (using normalizr for instance and as suggested by @mastilver in the link above) and then it's easy to update a given id in the reducer (es6 spread |
for instance could become
It guaranties immutability because every action returns a new state (same goes for your "substates" like adresses) |
Hi @tom-s, many thanks for your kind comments. Actually I confess this is the 2nd time in my life I'm using Redux, and the 1st time we used Immutable.js 😅 You can definitely submit a Pull Request! We would really be interested in reducers tests. |
We should use Immutable.js for the store, to simplify stuff.
The text was updated successfully, but these errors were encountered: