Skip to content

Instantly share code, notes, and snippets.

@TechnotronicOz
Forked from swannodette/pure.js
Created December 6, 2013 18:20
Show Gist options
  • Save TechnotronicOz/7829688 to your computer and use it in GitHub Desktop.
Save TechnotronicOz/7829688 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