score:5

Accepted answer
import React from 'react';
import pure from './pure.js';

@pure('myProp', 'anotherProp')
export default MyComponent extends React.Component {

    static propTypes = {
        myProp: React.PropTypes.any,
        anotherProp: React.PropTypes.any
    }

    render() {
        return <p>I only re-render, when my props changed.</p>;
    }

}

Related Query

More Query from same tag