Skip to content

Instantly share code, notes, and snippets.

@alexeisavca
Last active March 12, 2023 12:24
Show Gist options
  • Save alexeisavca/d4ff175fd16c93c8785d to your computer and use it in GitHub Desktop.
Save alexeisavca/d4ff175fd16c93c8785d to your computer and use it in GitHub Desktop.
A simple component to make ReactJs ignore subtrees
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
},
render (){
return React.Children.only(this.props.children);
}
};
module.exports = {
Class: ReactIgnore,
Component: React.createClass(ReactIgnore)
};
@janjachacz
Copy link

Such a simple solution!! Thanks a lot, it saved me a lot of hassle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment