-
Notifications
You must be signed in to change notification settings - Fork 801
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
"Compare is not a function" when composing React.memo with hocs #1135
Comments
4.0.0 does not "see" Memo, that's why it working (it's not working at all) |
Ah that makes sense. Maybe composing hocs with The hot reloading of a component that uses |
Yep. Not it aware, and doing something not expected with it. |
So it was broken for any Lazy around Class... as long as it's actually different |
4.6.3 (and actually new hot-loader/react-dom or webpack plugin) would solve the issue |
Can confirm that it works now 🙏 Thank you for fixing this so quickly! |
Description
Thank you for your work on making
react-hot-loader
compatible with React 16.7! I've tried upgrading an existing project to 16.7 and the latest version of RHL and ran into an issue.I've dug into the issue and bit and have found the issue seems to occur when composing a component with
React.memo
and some other HOCs.Actual behavior
react-dom
throws theCompare is not a function
, seemingly becauseComponent.compare
isundefined
instead ofnull
?Expected behavior
Hot reloading works as intended
Environment
React Hot Loader version: 4.6.2 with
@hot-loader/react-dom
alias.Hot reloading worked fine with version
4.0.0
Reproducible Demo
Here is a reproducible repo: https://github.com/niekert/rhl-context-memo-issue
The issue occurs when I change this line in the React component, though it seems to only occur every other change 🤔
It seems to be also somewhat related to this composed
connect
andReact.memo
in this component.On the branch
previous-hmr-version
of that repo,react-hot-loader@4.0.0
is installed. The issue does not occur there.The text was updated successfully, but these errors were encountered: