Remove isStatic

This can be replicated with a custom component that always returns false`
from `shouldComponentUpdate`. A generic implementation might look like:

```
var StaticContainer = React.createClass({
  shouldComponentUpdate: function() {
    return false;
  },

  render: function() {
    return this.transferPropsTo(this.props.children[0]);
  }
});
```

And then used in JSX as
`<StaticContainer><div>Hello!</div></StaticContainer>`, resulting in
only `<div>Hello!</div>` being inserted into the DOM.
This commit is contained in:
CommitSyncScript
2013-06-13 17:40:52 -07:00
committed by Paul O’Shannessy
parent e1fe13d0cb
commit f456f8fa8d
2 changed files with 2 additions and 5 deletions
+1 -3
View File
@@ -679,9 +679,7 @@ var ReactCompositeComponentMixin = {
var currentComponent = this._renderedComponent;
var nextComponent = this._renderValidatedComponent();
if (currentComponent.constructor === nextComponent.constructor) {
if (!nextComponent.props.isStatic) {
currentComponent.receiveProps(nextComponent.props, transaction);
}
currentComponent.receiveProps(nextComponent.props, transaction);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
+1 -2
View File
@@ -167,8 +167,7 @@ var ReactMultiChildMixin = {
this.enqueueMove(curChild._domIndex, loopDomIndex);
}
curChildrenDOMIndex = Math.max(curChild._domIndex, curChildrenDOMIndex);
!nextChild.props.isStatic &&
curChild.receiveProps(nextChild.props, transaction);
curChild.receiveProps(nextChild.props, transaction);
curChild._domIndex = loopDomIndex;
} else {
if (curChild) { // !shouldUpdate && curChild => delete