3 ms·
To properly embrace immutable.js and not have performance issues, you need to fully embrace it and it's API and use it as the basis for all of the models in you
by thatswrong0 7y ago
To properly embrace immutable.js and not have performance issues, you need to fully embrace it and it's API and use it as the basis for all of the models in your app. We did a half-baked approach which uses immutables in the data store (so we can leverage quick prop checks) but also convert those into normal JS objects in the business domain. This makes our use of it noticeably slow.
Immer [0] is a much better alternative IMO.. you get all the benefits of immutability without having to use a radically different API than normal. And the performance is roughly the same as immutable. And using it with Redux is natural [1], removing the need to do a bunch of nested object copies
[0] https://github.com/immerjs/immer https://github.com/immerjs/immer
[1] https://daveceddia.com/react-redux-immutability-guide/#easy-state-updates-with-immer https://daveceddia.com/react-redux-immutability-guide/#easy-...
- ng12 7y agoI don't use immutable.js or any other framework. Just regular, functional JS.