Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81155 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule ReactBrowserComponentMixin
10
*/
11
12
"use strict";
13
14
var ReactEmptyComponent = require('ReactEmptyComponent');
15
var ReactMount = require('ReactMount');
16
17
var invariant = require('invariant');
18
19
var ReactBrowserComponentMixin = {
20
/**
21
* Returns the DOM node rendered by this component.
22
*
23
* @return {DOMElement} The root node of this component.
24
* @final
25
* @protected
26
*/
27
getDOMNode: function() {
28
invariant(
29
this.isMounted(),
30
'getDOMNode(): A component must be mounted to have a DOM node.'
31
);
32
if (ReactEmptyComponent.isNullComponentID(this._rootNodeID)) {
33
return null;
34
}
35
return ReactMount.getNode(this._rootNodeID);
36
}
37
};
38
39
module.exports = ReactBrowserComponentMixin;
40
41