Last active
March 12, 2023 12:24
-
-
Save alexeisavca/d4ff175fd16c93c8785d to your computer and use it in GitHub Desktop.
A simple component to make ReactJs ignore subtrees
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Such a simple solution!! Thanks a lot, it saved me a lot of hassle.