mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Removes legacy TODOs in createfactory methods (#11942)
* Removes legacy TODO from createFactory() * Removes legacy TODO from createFactoryWithValidation() * Adds comment "Legacy hook: remove it" This is based on Dan Abramov's suggestion (source: https://github.com/facebook/react/pull/11942#issuecomment-354818632)
This commit is contained in:
committed by
Dan Abramov
parent
1ebeb0542f
commit
30dac4e78d
@@ -266,7 +266,7 @@ export function createFactory(type) {
|
||||
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
||||
// This should not be named `constructor` since this may not be the function
|
||||
// that created the element, and it may not even be a constructor.
|
||||
// Legacy hook TODO: Warn if this is accessed
|
||||
// Legacy hook: remove it
|
||||
factory.type = type;
|
||||
return factory;
|
||||
}
|
||||
|
||||
@@ -357,9 +357,8 @@ export function createElementWithValidation(type, props, children) {
|
||||
|
||||
export function createFactoryWithValidation(type) {
|
||||
const validatedFactory = createElementWithValidation.bind(null, type);
|
||||
// Legacy hook TODO: Warn if this is accessed
|
||||
validatedFactory.type = type;
|
||||
|
||||
// Legacy hook: remove it
|
||||
if (__DEV__) {
|
||||
Object.defineProperty(validatedFactory, 'type', {
|
||||
enumerable: false,
|
||||
|
||||
Reference in New Issue
Block a user