dillon1000/react
Commit
Browse files Add cloneElement Implementation
This is a new version of cloneWithProps but this one is moving out of add-ons. Unlike cloneWithProps, this one doesn't have special logic for style, className and children. This one also preserves the original ref. This is critical when upgrading from a mutative pattern where a child might have a ref on it. It also preserves context, which is similar to how context would work when it is parent based. It also ensures that we're compatible with the old mutative pattern which makes updates easier.
Changed paths4 files
First-parent comparisonsrc/browser/ui/React.js ModifiedM src/classic/element/ReactElement.js ModifiedM src/classic/element/ReactElementValidator.js ModifiedA src/classic/element/__tests__/ReactElementClone-test.js AddedPatch
Files changed
Rendering syntax-highlighted changes…