Rename TYPE_SYMBOL to REACT_ELEMENT_TYPE
See D2454031 for context.
Greg Perkins committed
Sep 28, 2015 at 14:10 UTC
c9320142ecc2d9637dcce0d0bf6aa18295a99e0e
2 files changed
+5
-5
src/isomorphic/classic/element/ReactElement.js
+3
-3
@@ -17,7 +17,7 @@ var assign = require('Object.assign');
17
18
// The Symbol used to tag the ReactElement type. If there is no native Symbol
19
// nor polyfill, then a plain number is used for performance.
20
-var TYPE_SYMBOL =
20
+var REACT_ELEMENT_TYPE =
21
(typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) ||
22
0xeac7;
23
@@ -59,7 +59,7 @@ if (__DEV__) {
59
var ReactElement = function(type, key, ref, self, source, owner, props) {
60
var element = {
61
// This tag allow us to uniquely identify this as a React Element
62
- $$typeof: TYPE_SYMBOL,
62
+ $$typeof: REACT_ELEMENT_TYPE,
63
64
// Built-in properties that belong on the element
65
type: type,
@@ -289,7 +289,7 @@ ReactElement.isValidElement = function(object) {
289
return (
290
typeof object === 'object' &&
291
object !== null &&
292
- object.$$typeof === TYPE_SYMBOL
292
+ object.$$typeof === REACT_ELEMENT_TYPE
293
);
294
};
295
src/isomorphic/classic/element/__tests__/ReactElement-test.js
+2
-2
@@ -327,14 +327,14 @@ describe('ReactElement', function() {
327
// Rudimentary polyfill
328
// Once all jest engines support Symbols natively we can swap this to test
329
// WITH native Symbols by default.
330
- var TYPE_SYMBOL = function() {}; // fake Symbol
330
+ var REACT_ELEMENT_TYPE = function() {}; // fake Symbol
331
var OTHER_SYMBOL = function() {}; // another fake Symbol
332
global.Symbol = function(name) {
333
return OTHER_SYMBOL;
334
};
335
global.Symbol.for = function(key) {
336
if (key === 'react.element') {
337
- return TYPE_SYMBOL;
337
+ return REACT_ELEMENT_TYPE;
338
}
339
return OTHER_SYMBOL;
340
};