New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-perfect

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-perfect

Simple render-saving library for your React components.

latest
Source
npmnpm
Version
3.0.1
Version published
Weekly downloads
5
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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:

class MyComponent extends PureComponent {
    render() {
        return (
            <>
                <div>{this.props.title}</div>
                <button onClick={this.props.update}>update</button>
            </>
        );
    }
}

// other props will still be passed, but their updates will be ignored
export default rerender.on(MyComponent, ["title"]); 

TODO

  • docs
  • unit tests

License:

MIT

FAQs

Package last updated on 28 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts