Use a helper function for React "inlining"
Either due to lower parsing costs or better type inference, this seems to perform better than direct object inlining. (All along, the main win was skipping a loop through props, not avoiding a function call.)
This commit is contained in:
@@ -1,30 +1,19 @@
|
||||
var _typeofReactElement = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
|
||||
var _createRawReactElement = (function () { var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7; return function createRawReactElement(type, key, props) { return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key, ref: null, props: props, _owner: null }; }; })();
|
||||
|
||||
var _ref = _createRawReactElement("foo", null, {});
|
||||
|
||||
var _ref = {
|
||||
$$typeof: _typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {},
|
||||
_owner: null
|
||||
};
|
||||
function render() {
|
||||
return _ref;
|
||||
}
|
||||
|
||||
function render() {
|
||||
var text = getText();
|
||||
var _ref2 = {
|
||||
$$typeof: _typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
children: text
|
||||
},
|
||||
_owner: null
|
||||
};
|
||||
|
||||
var _ref2 = _createRawReactElement("foo", null, {
|
||||
children: text
|
||||
});
|
||||
|
||||
return function () {
|
||||
return _ref2;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user