@samitouri / QOS-React / commits / 28dc560d0f

[Fiber] unmountComponentAtNode

Add unmounting hook.

Sebastian Markbage committed Jul 6, 2016 at 13:46 UTC 28dc560d0f2455f62e62847a62573b2508e55e4c
1 file changed +11 -1
src/renderers/dom/fiber/ReactDOMFiber.js
+11 -1
@@ -16,7 +16,7 @@ import type { HostChildren } from 'ReactFiberReconciler';
16
17 var ReactFiberReconciler = require('ReactFiberReconciler');
18
19 -type DOMContainerElement = Element & { _reactRootContainer: Object };
19 +type DOMContainerElement = Element & { _reactRootContainer: ?Object };
20
21 type Container = Element;
22 type Props = { };
@@ -92,6 +92,16 @@ var ReactDOM = {
92 }
93 },
94
95 + unmountComponentAtNode(container : DOMContainerElement) {
96 + const root = container._reactRootContainer;
97 + if (root) {
98 + // TODO: Is it safe to reset this now or should I wait since this
99 + // unmount could be deferred?
100 + container._reactRootContainer = null;
101 + DOMRenderer.unmountContainer(root);
102 + }
103 + },
104 +
105 };
106
107 module.exports = ReactDOM;