dillon1000/react

Commit

Allow arbitrary types to be wrapped in pure (#13903)

* Allow arbitrary types to be wrapped in pure

This creates an outer fiber that container the pure check and an inner
fiber that represents which ever type of component.

* Add optimized fast path for simple pure function components

Special cased when there are no defaultProps and it's a simple function
component instead of class. This doesn't require an extra fiber.

We could make it so that this also works with custom comparer but that
means we have to go through one extra indirection to get to it.
Maybe it's worth it, donno.
Browse files
Changed paths10 files
First-parent comparison
M packages/react-reconciler/src/ReactFiber.js ModifiedM packages/react-reconciler/src/ReactFiberBeginWork.js ModifiedM packages/react-reconciler/src/ReactFiberCompleteWork.js ModifiedM packages/react-reconciler/src/__tests__/ReactPure-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap ModifiedM packages/react-test-renderer/src/ReactTestRenderer.js ModifiedM packages/react/src/__tests__/forwardRef-test.js ModifiedM packages/react/src/pure.js ModifiedM packages/shared/ReactWorkTags.js ModifiedM packages/shared/getComponentName.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…