react-native/Libraries/vendor/react_contrib/StaticContainer/StaticContainer.js

51 lines
1.6 KiB
JavaScript

/**
* @generated SignedSource<<e158ef03956b8fface1e9d3f8d611322>>
*
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !! This file is a check-in of a static_upstream project! !!
* !! !!
* !! You should not modify this file directly. Instead: !!
* !! 1) Use `fjs use-upstream` to temporarily replace this with !!
* !! the latest version from upstream. !!
* !! 2) Make your changes, test them, etc. !!
* !! 3) Use `fjs push-upstream` to copy your changes back to !!
* !! static_upstream. !!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
* @providesModule StaticContainer.react
* @jsx React.DOM
*/
var React = require('React');
var onlyChild = require('onlyChild');
/**
* Renders static content efficiently by allowing React to short-circuit the
* reconciliation process. This component should be used when you know that a
* subtree of components will never need to be updated.
*
* var someValue = ...; // We know for certain this value will never change.
* return (
* <StaticContainer>
* <MyComponent value={someValue} />
* </StaticContainer>
* );
*
* Typically, you will not need to use this component and should opt for normal
* React reconciliation.
*/
var StaticContainer = React.createClass({
shouldComponentUpdate: function(nextProps) {
return nextProps.shouldUpdate;
},
render: function() {
return onlyChild(this.props.children);
}
});
module.exports = StaticContainer;