Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active December 30, 2015 09:39
Show Gist options
  • Save swannodette/7810960 to your computer and use it in GitHub Desktop.
Save swannodette/7810960 to your computer and use it in GitHub Desktop.
var PureComponent = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
return !equals(this.props.value, nextProps.value);
},
render: function() {
return this.props.children();
}
});
var pure = function(value, childrenThunk) {
return PureComponent({value: value}, childrenThunk);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment