dillon1000/react
Commit
Browse files Eagerly initialize an mutable object for instance.refs (#25696)
This micro-optimization never made sense and less so now that they're rare. This still initializes the class with a shared immutable object in the constructor - which is also what createClass() does. Then we override it during mount. This is done in case someone messes up the initialization of the super() constructor for example, which was more common in polyfills. This change means that if a ref is initialized during the constructor itself it wouldn't be lazily initialized but that's not user code that does it, it's React so that shouldn't happen. This makes string refs codemoddable as described in. https://github.com/facebook/react/pull/25334
Changed paths4 files
First-parent comparisonpackages/react-reconciler/src/ReactChildFiber.new.js ModifiedM packages/react-reconciler/src/ReactChildFiber.old.js ModifiedM packages/react-reconciler/src/ReactFiberClassComponent.new.js ModifiedM packages/react-reconciler/src/ReactFiberClassComponent.old.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…