mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Merge pull request #2177 from zpao/0.11-createElement
Add createElement for 0.11
This commit is contained in:
commit
c86c9d15df
1 file changed
+23
-3
+23
-3
@@ -38,9 +38,21 @@ var ReactServerRendering = require('ReactServerRendering');
|
||||
var ReactTextComponent = require('ReactTextComponent');
|
||||
|
||||
var onlyChild = require('onlyChild');
|
||||
var warning = require('warning');
|
||||
|
||||
ReactDefaultInjection.inject();
|
||||
|
||||
// Specifying arguments isn't necessary since we just use apply anyway, but it
|
||||
// makes it clear for those actually consuming this API.
|
||||
function createDescriptor(type, props, children) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return type.apply(null, args);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
var _warnedForDeprecation = false;
|
||||
}
|
||||
|
||||
var React = {
|
||||
Children: {
|
||||
map: ReactChildren.map,
|
||||
@@ -54,10 +66,18 @@ var React = {
|
||||
EventPluginUtils.useTouchEvents = shouldUseTouch;
|
||||
},
|
||||
createClass: ReactCompositeComponent.createClass,
|
||||
createDescriptor: function(type, props, children) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return type.apply(null, args);
|
||||
createDescriptor: function() {
|
||||
if (__DEV__) {
|
||||
warning(
|
||||
_warnedForDeprecation,
|
||||
'React.createDescriptor is deprecated and will be removed in the ' +
|
||||
'next version of React. Use React.createElement instead.'
|
||||
);
|
||||
_warnedForDeprecation = true;
|
||||
}
|
||||
return createDescriptor.apply(this, arguments);
|
||||
},
|
||||
createElement: createDescriptor,
|
||||
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
|
||||
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
|
||||
renderComponent: ReactPerf.measure(
|
||||
|
||||
Reference in new issue
Block a user