Failed using preact/compat with react-hot-reload and react-router
See original GitHub issueHi,
I tried to migrate from react to preact, so installed preact: "^10.0.0-rc.0"
and define alias of preact/compat
inside webpack.
I also have react-router-dom: "^5.0.1"
installed.
I set up react-hot-loader: "^4.9.0"
as well.
in case of production, everything works fine.(react-hot-loader not getting import)
in case of development, I face Uncaught Error: Invariant failed: You should not use <Switch> outside a <Router>
error.
I also installed preact: "^8.4.2"
and preact-compat
and changed my alias to preact-compat
and everything worked fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Switching to Preact (from React)
Switching to Preact can be as easy as installing and aliasing preact-compat in for react and react-dom . This lets you continue writing...
Read more >Hot Reload is not working in my React App
I was following a tutorial that used react-router-dom@5.1 . Nothing worked at all including both .env suggestions, the react-scripts suggestion, ...
Read more >react-hot-loader
Start using react-hot-loader in your project by running `npm i ... React-hot-loader should work out of the box with preact-compat , but, in...
Read more >Introduction to Preact : A smaller, faster React alternative
Using preact -compat for compatibility between Preact and React ... This starts up a dev server with Hot Module Reloading(HMR) at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI: We now have an official HMR solution for Preact called prefresh. We recommend everyone switching over to use that 🎉
@marvinhagemeister should this labeled as a bug?