From f456f8fa8d833016e4846e41d04b28cafff7a4a5 Mon Sep 17 00:00:00 2001 From: CommitSyncScript Date: Thu, 13 Jun 2013 16:33:31 -0700 Subject: [PATCH] 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 `
Hello!
`, resulting in only `
Hello!
` being inserted into the DOM. --- src/core/ReactCompositeComponent.js | 4 +--- src/core/ReactMultiChild.js | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/ReactCompositeComponent.js b/src/core/ReactCompositeComponent.js index 3fed7ad324..ac2e57d93c 100644 --- a/src/core/ReactCompositeComponent.js +++ b/src/core/ReactCompositeComponent.js @@ -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; diff --git a/src/core/ReactMultiChild.js b/src/core/ReactMultiChild.js index 80dcb646b2..9b4a64572c 100644 --- a/src/core/ReactMultiChild.js +++ b/src/core/ReactMultiChild.js @@ -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