New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache wrapped function element in shallow renderer #2014

Open
wants to merge 3 commits into
base: master
from

Conversation

2 participants
@rodrigopr
Copy link

rodrigopr commented Feb 8, 2019

This is necessary because ReactShallowRender checks for equality in function components to decide if it should keep hooks state between renders.

This along with facebook/react#14802 / facebook/react#14840 should help in test components with some of the core hooks.
link #2011 , #2008 and #1996

@rodrigopr rodrigopr force-pushed the rodrigopr:rodrigopr/cache-shallowed-wrapper-element branch from 454c51c to ae30cfd Feb 8, 2019

@ljharb ljharb added this to Lifecycles in React 16 Feb 9, 2019

@ljharb ljharb moved this from Lifecycles to v16.8+: Hooks in React 16 Feb 9, 2019

@ljharb
Copy link
Member

ljharb left a comment

Seems great! Can you add a test that fails without this change?

@rodrigopr

This comment has been minimized.

Copy link
Author

rodrigopr commented Feb 11, 2019

@ljharb sure, I guess I'll wait for the react PR to be merged to do a more meaningful test for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment