https://github.com/dzek69/react-perfect
Simple render-saving library for your React components.
https://github.com/dzek69/react-perfect
javascript performance react react-native react-performance
Last synced: 10 months ago
JSON representation
Simple render-saving library for your React components.
- Host: GitHub
- URL: https://github.com/dzek69/react-perfect
- Owner: dzek69
- License: mit
- Created: 2019-07-08T08:52:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-06T05:58:59.000Z (over 2 years ago)
- Last Synced: 2025-02-24T06:39:03.794Z (10 months ago)
- Topics: javascript, performance, react, react-native, react-performance
- Language: JavaScript
- Homepage:
- Size: 2.54 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 on `ownProps`) for each redux state
change. If your state change doesn't affect data you're returning with `mapStateToProps` - your connected component
will be re-rendered even when using `PureComponent`
## Usage
Proper docs are in @TODO state, sorry :)
tl;dr:
```jsx harmony
class MyComponent extends PureComponent {
render() {
return (
<>
{this.props.title}
update
>
);
}
}
// other props will still be passed, but their updates will be ignored
export default rerender.on(MyComponent, ["title"]);
```
## TODO
- docs
- unit tests
## License:
MIT