-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 with reacts appends a new app instance instead of replace the current #2509
Comments
Parcel's HMR simply reruns the code, it seems like |
@mischnic Ok, thanks for the quick answer. So I've managed to solve it like this: const rootNode = document.getElementById('root');
while (rootNode.lastChild) {
rootNode.removeChild(rootNode.lastChild);
}
ReactDOM.createRoot(rootNode).render(
<StrictMode>
<Router>
<ApolloProvider client={client}>
<App />
</ApolloProvider>
</Router>
</StrictMode>,
); |
@DeMoorJasper possibly this issue should be reopened. Parcel must support new react async mode (ReactDOM.createRoot) |
I would like to take this up. First issue here, would really appreciate if anyone could give me some pointers and direction. |
Pinging again, if any participant would like to guide through. I wish to get started on this at the earliest 😃 |
@karansapolia I wouldn't really consider this a bug in parcel itself, it's rather a side effect of how the hot module reloading works (and I don't really see how this can be fixed without being specific to react - and createRoot isnt even documented in the react api?) I would recommend taking a look at a different issue. |
@mischnic Thank you for the quick reply. If that's the case, sure I'll move to other issues. |
I have a parcel + react + css modules project. Whenever I save a file, the entire application gets re-rendered and appended to the #root container instead of replacing the whole thing.
This is what my index.js file looks like:
This is what it looks like when I save the same file three times.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: