You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delete or add one of the hooks there, and you should get the error
Background:
at mobx we've got a bug report, and we've figured it's not on mobx side, but react-refresh/the webpack plugin mobxjs/mobx#2668, as in the above repro.
I've opened the issue here because injecting the hash for a component in a co-op between the plugin and react-refresh.
I've going to open the issue there as-well
Keywords:
Rendered more hooks than during the previous render
Rendered fewer hooks than expected
The text was updated successfully, but these errors were encountered:
Is this plugin still maintained? Is there a plugin that is updated more regular?
Or what would be the recommended way to use react-refresh with Webpack?
When updating HOC-wrapped component to a different number//kinds of hooks, you get the "Rendered fewer hooks than expected" error from React
Repro:
https://codesandbox.io/s/react-refresh-webpack-plugin-rendered-more-hooks-than-during-the-previous-render-issue-ezcrz?file=/src/Comp.js
Delete or add one of the hooks there, and you should get the error
Background:
at mobx we've got a bug report, and we've figured it's not on mobx side, but react-refresh/the webpack plugin
mobxjs/mobx#2668, as in the above repro.
After some debugging, It seems like when HOC, renderprops or similar composition patterns are involved,
The the relevant components aren't getting signature hash,
And React, when the old and new component does not have a signature, tries to refresh the component anyhow:
https://github.com/facebook/react/blob/9aca239f11f31109dc1a229aa1571c2bf02f5524/packages/react-refresh/src/ReactFreshRuntime.js#L126-L132
I've opened the issue here because injecting the hash for a component in a co-op between the plugin and react-refresh.
I've going to open the issue there as-well
Keywords:
Rendered more hooks than during the previous render
Rendered fewer hooks than expected
The text was updated successfully, but these errors were encountered: