@samitouri / QOS-React-2 / commits / f456f8fa8d
Fork 0

The library for web and native user interfaces.

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.

CommitSyncScript committed Jun 13, 2013 at 16:33 UTC f456f8fa8d833016e4846e41d04b28cafff7a4a5
2 files changed +2 -5
src/core/ReactCompositeComponent.js
+1 -3
@@ -679,9 +679,7 @@ var ReactCompositeComponentMixin = {
679 var currentComponent = this._renderedComponent;
680 var nextComponent = this._renderValidatedComponent();
681 if (currentComponent.constructor === nextComponent.constructor) {
682 - if (!nextComponent.props.isStatic) {
683 - currentComponent.receiveProps(nextComponent.props, transaction);
684 - }
682 + currentComponent.receiveProps(nextComponent.props, transaction);
683 } else {
684 // These two IDs are actually the same! But nothing should rely on that.
685 var thisID = this._rootNodeID;
src/core/ReactMultiChild.js
+1 -2
@@ -167,8 +167,7 @@ var ReactMultiChildMixin = {
167 this.enqueueMove(curChild._domIndex, loopDomIndex);
168 }
169 curChildrenDOMIndex = Math.max(curChild._domIndex, curChildrenDOMIndex);
170 - !nextChild.props.isStatic &&
171 - curChild.receiveProps(nextChild.props, transaction);
170 + curChild.receiveProps(nextChild.props, transaction);
171 curChild._domIndex = loopDomIndex;
172 } else {
173 if (curChild) { // !shouldUpdate && curChild => delete