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:
Santosh Venkatraman
2018-01-04 19:40:02 +00:00
committed by Dan Abramov
parent 1ebeb0542f
commit 30dac4e78d
2 changed files with 2 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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,