-
Notifications
You must be signed in to change notification settings - Fork 47k
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
react-is: 16.12.0 isMemo is returning wrong value #17457
Comments
This changed in v16.12: #17278 |
@milesj Thanks for your quick reply. https://codesandbox.io/s/determined-lehmann-hl43r
|
@milesj I will try some work around in our side and open issue in material UI and enzyme repo then. Thanks again for your quick reply. |
As the linked PR #17278 mentions: const MemoizedComponent = React.memo(MyComponent);
// MemoizedComponent is a valid element TYPE.
expect(ReactIs.isValidElementType(MemoizedComponent)).toBe(true);
// <MemoizedComponent /> is a valid element.
expect(ReactIs.typeOf(<MemoizedComponent />)).toBe(ReactIs.Memo);
expect(ReactIs.isMemo(<MemoizedComponent />)).toBe(true);
// MemoizedComponent is NOT an element!
// (This used to return a false positive.)
expect(ReactIs.isMemo(MemoizedComponent)).toBe(false); The previous behavior was broken. It's unfortunate that the bug fix caused some existing use cases to "break" but I think it was still the right change to make. Sorry for the inconvenience! |
Bug in react-is: 16.12.0
https://codesandbox.io/s/determined-lehmann-hl43r
This issue does not exist in ### 16.11.0
https://codesandbox.io/s/nifty-paper-8cqil
The text was updated successfully, but these errors were encountered: