When I save a file in my project (even if it wasn't changed) that provides a Context and the respective Provider, HMR will try to hot-reload the page and crash it in the process.
The error message is TypeError: _reactDefault.default.useContext(...) is undefined.
Same with me it, it can break anything. I got an issue with 'react' is not found. Also, HMR does not work when you use useContext.
Modify any code anywhere in the source code, the page refreshes. HMR does not work. Also states get reset. tried preserving the logs. it crashes the code.
๐ bug report
When I save a file in my project (even if it wasn't changed) that provides a Context and the respective Provider, HMR will try to hot-reload the page and crash it in the process.
The error message is
TypeError: _reactDefault.default.useContext(...) is undefined
.๐ Configuration (.babelrc, package.json, cli command)
No babel, I just run
๐ค Expected Behavior
I would expect the hot reload to work.
๐ฏ Current Behavior
The page crashes with the following error:
๐ Possible Solution
If only I knew ๐คท
๐ฆ Context
I wanted to create a Provider component to avoid prop drilling as part of an exercise.
๐ป Code Sample
See https://github.com/iFreilicht/project-toast/tree/parcel-hmr-repro. To quote the README:
๐ Your Environment
Same with me it, it can break anything. I got an issue with 'react' is not found. Also, HMR does not work when you use useContext.
Modify any code anywhere in the source code, the page refreshes. HMR does not work. Also states get reset. tried preserving the logs. it crashes the code.