react-perfect
Simple render-saving library for your React components.
Features
- saves from writing simple-but-repeating shouldComponentUpdate
- ideal for
react-redux
* - ideal for plugin-like components when you're not controlling the props you are receiving and you don't rely on some of them when rendering
- 1,5 kB of source code, should be few hundreds of bytes of minified & gzippped code
-
mapDispatchToProps
is returning new method instances (even if they don't rely onownProps
) for each redux state change. If your state change doesn't affect data you're returning withmapStateToProps
- your connected component will be re-rendered even when usingPureComponent
Usage
Proper docs are in @TODO state, sorry :)
tl;dr:
{ return <> <div>thispropstitle</div> <button =>update</button> </> ; } // other props will still be passed, but their updates will be ignored;
TODO
- docs
- unit tests
License:
MIT