@samitouri / QOS-React / commits / 30dac4e78d

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)

Santosh Venkatraman committed Jan 4, 2018 at 19:40 UTC 30dac4e78de02fb427ee82013160ae875128d7a2
2 files changed +2 -3
packages/react/src/ReactElement.js
+1 -1
@@ -266,7 +266,7 @@ export function createFactory(type) {
266 // easily accessed on elements. E.g. `<Foo />.type === Foo`.
267 // This should not be named `constructor` since this may not be the function
268 // that created the element, and it may not even be a constructor.
269 - // Legacy hook TODO: Warn if this is accessed
269 + // Legacy hook: remove it
270 factory.type = type;
271 return factory;
272 }
packages/react/src/ReactElementValidator.js
+1 -2
@@ -357,9 +357,8 @@ export function createElementWithValidation(type, props, children) {
357
358 export function createFactoryWithValidation(type) {
359 const validatedFactory = createElementWithValidation.bind(null, type);
360 - // Legacy hook TODO: Warn if this is accessed
360 validatedFactory.type = type;
362 -
361 + // Legacy hook: remove it
362 if (__DEV__) {
363 Object.defineProperty(validatedFactory, 'type', {
364 enumerable: false,