3 ms·
Semi-tangential note: React comes with the helpful `React.addons.update`, which implements "immutable data structures" in an extremely simple way. I'm working
by mbrock 11y ago
Semi-tangential note: React comes with the helpful `React.addons.update`, which implements "immutable data structures" in an extremely simple way.
I'm working on a medium-sized React application where all application state changes go through this function—there's one big state object with all substate, and we don't do any mutation inside of it. We haven't needed to benchmark anything yet, nor do we have any extreme performance requirements.
Since all our state updates work like this, we can use `PureRenderMixin` on all components, which gives us the kind of shallow equality behavior you describe.
- graffitici 11y agoI see, so there's no need to even use an external library. It doesn't look like they are using the PureRenderMixin for the benchmarks. Would be curious to see how they compare then..
- mbrock 11y agoThey do implement `shouldComponentUpdate` on the todo items in a way that should give about the same performance boost. (All the pure render mixin does is implement that method using shallow equality.)