Skip to content

Commit 120239f

Browse files
committed
Remove React.createFactory (#27798)
`React.createFactory` has been long deprecated. This removes it for the next release. DiffTrain build for [2aed507](2aed507)
1 parent 2d29da8 commit 120239f

File tree

5 files changed

+78
-137
lines changed

5 files changed

+78
-137
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6cd6ba703de77e332ab201518b6e30e47cd49aaf
1+
2aed507a76a0b1524426c398897cbe47d80c51e5

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "19.0.0-www-classic-8c9925ed";
27+
var ReactVersion = "19.0.0-www-classic-83a7d6d7";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -1858,50 +1858,6 @@ if (__DEV__) {
18581858

18591859
return element;
18601860
}
1861-
var didWarnAboutDeprecatedCreateFactory = false;
1862-
/**
1863-
* Return a function that produces ReactElements of a given type.
1864-
* See https://reactjs.org/docs/react-api.html#createfactory
1865-
*/
1866-
1867-
function createFactory(type) {
1868-
var factory = createElement.bind(null, type); // Expose the type on the factory and the prototype so that it can be
1869-
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
1870-
// This should not be named `constructor` since this may not be the function
1871-
// that created the element, and it may not even be a constructor.
1872-
// Legacy hook: remove it
1873-
1874-
factory.type = type;
1875-
1876-
{
1877-
if (!didWarnAboutDeprecatedCreateFactory) {
1878-
didWarnAboutDeprecatedCreateFactory = true;
1879-
1880-
warn(
1881-
"React.createFactory() is deprecated and will be removed in " +
1882-
"a future major release. Consider using JSX " +
1883-
"or use React.createElement() directly instead."
1884-
);
1885-
} // Legacy hook: remove it
1886-
1887-
Object.defineProperty(factory, "type", {
1888-
enumerable: false,
1889-
get: function () {
1890-
warn(
1891-
"Factory.type is deprecated. Access the class directly " +
1892-
"before passing it to createFactory."
1893-
);
1894-
1895-
Object.defineProperty(this, "type", {
1896-
value: type
1897-
});
1898-
return type;
1899-
}
1900-
});
1901-
}
1902-
1903-
return factory;
1904-
}
19051861
function cloneAndReplaceKey(oldElement, newKey) {
19061862
return ReactElement(
19071863
oldElement.type,
@@ -3704,7 +3660,6 @@ if (__DEV__) {
37043660
exports.cloneElement = cloneElement;
37053661
exports.createContext = createContext;
37063662
exports.createElement = createElement;
3707-
exports.createFactory = createFactory;
37083663
exports.createRef = createRef;
37093664
exports.experimental_useEffectEvent = useEffectEvent;
37103665
exports.forwardRef = forwardRef;

compiled/facebook-www/React-prod.classic.js

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -136,44 +136,6 @@ function jsxProd(type, config, maybeKey) {
136136
props
137137
);
138138
}
139-
function createElement(type, config, children) {
140-
var propName,
141-
props = {},
142-
key = null,
143-
ref = null;
144-
if (null != config)
145-
for (propName in (void 0 === config.ref ||
146-
enableRefAsProp ||
147-
(ref = config.ref),
148-
void 0 !== config.key && (key = "" + config.key),
149-
config))
150-
hasOwnProperty.call(config, propName) &&
151-
"key" !== propName &&
152-
(enableRefAsProp || "ref" !== propName) &&
153-
"__self" !== propName &&
154-
"__source" !== propName &&
155-
(props[propName] = config[propName]);
156-
var childrenLength = arguments.length - 2;
157-
if (1 === childrenLength) props.children = children;
158-
else if (1 < childrenLength) {
159-
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
160-
childArray[i] = arguments[i + 2];
161-
props.children = childArray;
162-
}
163-
if (type && type.defaultProps)
164-
for (propName in ((childrenLength = type.defaultProps), childrenLength))
165-
void 0 === props[propName] &&
166-
(props[propName] = childrenLength[propName]);
167-
return ReactElement(
168-
type,
169-
key,
170-
ref,
171-
void 0,
172-
void 0,
173-
ReactCurrentOwner.current,
174-
props
175-
);
176-
}
177139
function cloneAndReplaceKey(oldElement, newKey) {
178140
return ReactElement(
179141
oldElement.type,
@@ -515,11 +477,43 @@ exports.createContext = function (defaultValue) {
515477
(defaultValue.Consumer = defaultValue));
516478
return defaultValue;
517479
};
518-
exports.createElement = createElement;
519-
exports.createFactory = function (type) {
520-
var factory = createElement.bind(null, type);
521-
factory.type = type;
522-
return factory;
480+
exports.createElement = function (type, config, children) {
481+
var propName,
482+
props = {},
483+
key = null,
484+
ref = null;
485+
if (null != config)
486+
for (propName in (void 0 === config.ref ||
487+
enableRefAsProp ||
488+
(ref = config.ref),
489+
void 0 !== config.key && (key = "" + config.key),
490+
config))
491+
hasOwnProperty.call(config, propName) &&
492+
"key" !== propName &&
493+
(enableRefAsProp || "ref" !== propName) &&
494+
"__self" !== propName &&
495+
"__source" !== propName &&
496+
(props[propName] = config[propName]);
497+
var childrenLength = arguments.length - 2;
498+
if (1 === childrenLength) props.children = children;
499+
else if (1 < childrenLength) {
500+
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
501+
childArray[i] = arguments[i + 2];
502+
props.children = childArray;
503+
}
504+
if (type && type.defaultProps)
505+
for (propName in ((childrenLength = type.defaultProps), childrenLength))
506+
void 0 === props[propName] &&
507+
(props[propName] = childrenLength[propName]);
508+
return ReactElement(
509+
type,
510+
key,
511+
ref,
512+
void 0,
513+
void 0,
514+
ReactCurrentOwner.current,
515+
props
516+
);
523517
};
524518
exports.createRef = function () {
525519
return { current: null };
@@ -666,4 +660,4 @@ exports.useSyncExternalStore = function (
666660
exports.useTransition = function () {
667661
return ReactCurrentDispatcher.current.useTransition();
668662
};
669-
exports.version = "19.0.0-www-classic-53088215";
663+
exports.version = "19.0.0-www-classic-b1e9d190";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -140,44 +140,6 @@ function jsxProd(type, config, maybeKey) {
140140
props
141141
);
142142
}
143-
function createElement(type, config, children) {
144-
var propName,
145-
props = {},
146-
key = null,
147-
ref = null;
148-
if (null != config)
149-
for (propName in (void 0 === config.ref ||
150-
enableRefAsProp ||
151-
(ref = config.ref),
152-
void 0 !== config.key && (key = "" + config.key),
153-
config))
154-
hasOwnProperty.call(config, propName) &&
155-
"key" !== propName &&
156-
(enableRefAsProp || "ref" !== propName) &&
157-
"__self" !== propName &&
158-
"__source" !== propName &&
159-
(props[propName] = config[propName]);
160-
var childrenLength = arguments.length - 2;
161-
if (1 === childrenLength) props.children = children;
162-
else if (1 < childrenLength) {
163-
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
164-
childArray[i] = arguments[i + 2];
165-
props.children = childArray;
166-
}
167-
if (type && type.defaultProps)
168-
for (propName in ((childrenLength = type.defaultProps), childrenLength))
169-
void 0 === props[propName] &&
170-
(props[propName] = childrenLength[propName]);
171-
return ReactElement(
172-
type,
173-
key,
174-
ref,
175-
void 0,
176-
void 0,
177-
ReactCurrentOwner.current,
178-
props
179-
);
180-
}
181143
function cloneAndReplaceKey(oldElement, newKey) {
182144
return ReactElement(
183145
oldElement.type,
@@ -519,11 +481,43 @@ exports.createContext = function (defaultValue) {
519481
(defaultValue.Consumer = defaultValue));
520482
return defaultValue;
521483
};
522-
exports.createElement = createElement;
523-
exports.createFactory = function (type) {
524-
var factory = createElement.bind(null, type);
525-
factory.type = type;
526-
return factory;
484+
exports.createElement = function (type, config, children) {
485+
var propName,
486+
props = {},
487+
key = null,
488+
ref = null;
489+
if (null != config)
490+
for (propName in (void 0 === config.ref ||
491+
enableRefAsProp ||
492+
(ref = config.ref),
493+
void 0 !== config.key && (key = "" + config.key),
494+
config))
495+
hasOwnProperty.call(config, propName) &&
496+
"key" !== propName &&
497+
(enableRefAsProp || "ref" !== propName) &&
498+
"__self" !== propName &&
499+
"__source" !== propName &&
500+
(props[propName] = config[propName]);
501+
var childrenLength = arguments.length - 2;
502+
if (1 === childrenLength) props.children = children;
503+
else if (1 < childrenLength) {
504+
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
505+
childArray[i] = arguments[i + 2];
506+
props.children = childArray;
507+
}
508+
if (type && type.defaultProps)
509+
for (propName in ((childrenLength = type.defaultProps), childrenLength))
510+
void 0 === props[propName] &&
511+
(props[propName] = childrenLength[propName]);
512+
return ReactElement(
513+
type,
514+
key,
515+
ref,
516+
void 0,
517+
void 0,
518+
ReactCurrentOwner.current,
519+
props
520+
);
527521
};
528522
exports.createRef = function () {
529523
return { current: null };
@@ -670,7 +664,7 @@ exports.useSyncExternalStore = function (
670664
exports.useTransition = function () {
671665
return ReactCurrentDispatcher.current.useTransition();
672666
};
673-
exports.version = "19.0.0-www-classic-15c65c77";
667+
exports.version = "19.0.0-www-classic-7ee6e970";
674668
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
675669
"function" ===
676670
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/__test_utils__/ReactAllWarnings.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)