dillon1000/react
Commit
Browse files [Shallow] Implement setState for Hooks and remount on type change (#15120)
* Throw away old shallow renderer state on type change This worked in function components but was broken for classes. It incorrectly retained the old instance even if the type was different. * Remove _previousComponentIdentity We only needed this because we didn't correctly reset based on type. Now we do so this can go away. * Use _reset when unmounting * Use arbitrary componentIdentity There was no particular reason it was set to element.type. We just wanted to check if something is a render phase update. * Support Hook state updates in shallow renderer
Changed paths3 files
First-parent comparisonpackages/react-test-renderer/src/ReactShallowRenderer.js ModifiedM packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js ModifiedM packages/react-test-renderer/src/__tests__/ReactShallowRendererHooks-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…