DEV Community

Discussion on: Functional Programming in JS, part II - Immutability (Vanilla JS, Immutable.js and Immer)

Collapse
 
iquardt profile image
Iven Marquardt • Edited

I agree with your assessment of immer. Lack of composability is a deal breaker for larger projects.

Interestingly plain old Javascript objects are inherently immutable if you use them with functional lenses or with a mechanism that creates a shallow copy of the path you edit a node on.

Collapse
 
mpodlasin profile image
mpodlasin

Thanks for the comment!

I 100% agree with you. In my own projects I always default to plain old JS objects.

I forgot to mention that utility libraries like Ramda and lodash/fp always work in an immutable way. So if something is cumbersome to write in native JS, it's a good idea to check out what does libraries offer. :)