Sep 4, 2018 · 1 min read
The concept of `PureComponentMinusHandlers` is very interesting. The requirement to not pass the handlers directly to the child elements could be hard to enforce.
This can be fixed with a HOC that wraps all the handler props inside unchanging methods. For example instead of passing down the ever-changing this.props.onCollapse it can pass this.onCollapse created only once.
Such HOC already exists! It’s https://www.npmjs.com/package/react-pure-events that probably deserves more attention that it’s got so far.
Automatically wrapping all handler functions into unchanging methods also removes the need to skip the handlers in the shouldComponentUpdate. It might still be worth to do so, but as you pointed out: we don’t know unless we try.
