2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2015-07-06 22:00:17 +00:00
|
|
|
* @generated SignedSource<<2a163cdb088fb963f941e627fd89ce11>>
|
2015-01-30 01:10:49 +00:00
|
|
|
*
|
|
|
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
* !! 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. !!
|
|
|
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
*
|
2015-07-06 22:00:17 +00:00
|
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
*
|
2015-01-30 01:10:49 +00:00
|
|
|
* @providesModule StaticContainer.react
|
2015-07-06 22:00:17 +00:00
|
|
|
* @typechecks
|
|
|
|
* @flow
|
2015-01-30 01:10:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
2015-07-06 22:00:17 +00:00
|
|
|
class StaticContainer extends React.Component {
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-07-06 22:00:17 +00:00
|
|
|
shouldComponentUpdate(nextProps: Object): boolean {
|
|
|
|
return !!nextProps.shouldUpdate;
|
|
|
|
}
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-07-06 22:00:17 +00:00
|
|
|
render() {
|
|
|
|
var child = this.props.children;
|
|
|
|
return (child === null || child === false) ? null : onlyChild(child);
|
2015-01-30 01:10:49 +00:00
|
|
|
}
|
|
|
|
|
2015-07-06 22:00:17 +00:00
|
|
|
}
|
2015-01-30 01:10:49 +00:00
|
|
|
|
|
|
|
module.exports = StaticContainer;
|