Closed
Description
Per discussion in #1751 , it's time we added a recipes page to cover performance and optimization. @JAndritsch has volunteered to help write it, and I can definitely provide feedback and assistance.
Initial potential set of topics to cover per that discussion:
- Connect components to state at the lowest level possible to prevent cascading renders from parent to children.
- Normalize your data and pass collections of IDs instead of collections of large objects to components.
- Use ImmutableJS.
- Take advantage of "initialProps".
- Re-define shouldComponentUpdate() when necessary.
- Use React.addons.Perf to find and eliminate wasted renders.
- Use Chrome's built-in profiling tools.
- Memoization with Reselect
- Per-instance component memoization
- Performance in general. That subscriptions are O(n), that React Redux shallowly compares props, that memoization helps us avoid recalculations, etc.
Link-dumping a bunch of potential references, docs, and discussions:
- https://github.com/markerikson/react-redux-links/blob/master/react-performance.md
- http://somebody32.github.io/high-performance-redux/
- http://stackoverflow.com/questions/37264415/how-to-optimize-small-updates-to-props-of-nested-component-in-react-redux
- Optimize things a little bit mweststrate/redux-todomvc#1
- http://stackoverflow.com/questions/37285200/react-redux-performance-optimization-with-componentshouldupdate
- https://twitter.com/dan_abramov/status/720219615041859584
- Move frequently changing values out of the page object mozilla/tofino#282
- https://twitter.com/dan_abramov/status/733742952657342464
- https://twitter.com/dan_abramov/status/719723707124604928
- Middleware should be passing EFFECT actions? redux-saga/redux-saga#241 (comment)