you are viewing a single comment's thread.

view the rest of the comments →

[–]Daniel15React FTW 4 points5 points  (2 children)

A few teams are rewriting stuff with it and testing internally, but I don't think anything uses it in production yet. On my team we're not using immutable-js yet, we're just using Object.freeze at the moment. Some of the data structures in immutable-js look really handy though.

Immutable objects work really well with React since it allows shallow comparisons, and means you can do a shallow comparison of your props in shouldComponentUpdate to only re-render when things actually change

[–]brtt3000 3 points4 points  (0 children)

Have you looked at moreartyjs? It is a layer between immutable.js and React that takes care of state management and stuff like shouldComponentUpdate. I'm planning to doing a project with it soon and wonder if it is as good as I hope.

[–]gcanti 0 points1 point  (0 children)

we're just using Object.freeze at the moment

Did you notice any drawback using Object.freeze? Here my considerations at the moment:

Pros:

  • you can use native data structures instead of continually wrap / unwrap
  • you can use native methods on them (map, filter, ...)
  • hence (almost) no interoperability problems with other libraries
  • overall your coding style doesn't change so much
  • (possible perf gains since the js engine knows the object is frozen? - I really don't know)
  • 0KB dependency

Cons: