The library for web and native user interfaces.
Add typecheck, cleanup
Followup with some additional comments for https://github.com/facebook/react/pull/58
CommitSyncScript committed
Jun 6, 2013 at 14:45 UTC
2dc24fc2343b6120d8b80df9e9e070917cc197d9
1 file changed
+7
-6
src/core/ReactMount.js
+7
-6
@@ -196,18 +196,19 @@ var ReactMount = {
196
* Unmounts and destroys the React component rendered in the `container`.
197
*
198
* @param {DOMElement} container DOM element containing a React component.
199
+ * @return {boolean} True if a component was found in and unmounted from
200
+ * `container`
201
*/
202
unmountAndReleaseReactRootNode: function(container) {
203
var reactRootID = getReactRootID(container);
204
var component = instanceByReactRootID[reactRootID];
203
- if (component) {
204
- component.unmountComponentFromNode(container);
205
- delete instanceByReactRootID[reactRootID];
206
- delete containersByReactRootID[reactRootID];
207
- return true;
208
- } else {
205
+ if (!component) {
206
return false;
207
}
208
+ component.unmountComponentFromNode(container);
209
+ delete instanceByReactRootID[reactRootID];
210
+ delete containersByReactRootID[reactRootID];
211
+ return true;
212
},
213
214
/**