DEV Community

loading...

Discussion on: What happened to Immutable.JS? And how can we react?

Collapse
alekseiberezkin profile image
Aleksei Berezkin Author

Thanks for sharing links. While linked lists definitely have their usage, we must keep in mind that access by index costs O(n)O(n) for them. Yet, because each item produces additional object(s), memory fragmentation increases.

Ordered map is indeed a problem in JS, and devs should either implement it, or use some lib, or just order and array of [key, value] tuples. Which is best? It depends 🙂

Collapse
iquardt profile image
Iven Marquardt

You're right. However, I think index based access is overrated, because you don't need it that often.

Btw. I don't think immer.js is a good solution, because it doesn't seem to compose.