Skip to content
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

hmr no work in React.PureComponent #1900

Closed
zhaopan-pan opened this issue Jan 11, 2023 · 2 comments
Closed

hmr no work in React.PureComponent #1900

zhaopan-pan opened this issue Jan 11, 2023 · 2 comments

Comments

@zhaopan-pan
Copy link

Description

It's strange that my component can't trigger HMR normally in React.PureComponent, but it's normal in React.Component.
HMR works fine if I replace React.PureComponent in Routes with React.Component.
Has anyone encountered such a problem?

Expected behavior

React.PureComponent can be use HMR

Actual behavior

bug
20230111105644

Environment

"react-hot-loader": "^4.13.1",
"react": "^17.0.2",
"webpack": "^4.44.2",
"webpack-dev-server": "^3.11.2",
node: v14.19.1
chrome:108.0.5359.124

@theKashey
Copy link
Collaborator

React-Hot-Loader has a special logic to trigger force re-render in PureComponents and cause update of affected components... which was never tested for React 17. So something might got broken here and there.

Unfortunately, the fix is not coming, at least from my side - #1848

@zhaopan-pan
Copy link
Author

all right, I think it's time use react-refresh to replace RHL.
thank you for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants