electron-userland / electron-webpack

Scripts and configurations to compile Electron applications using webpack
https://webpack.electron.build/
903 stars 170 forks source link

rendering react-router-dom hooks cause hooks rules error #435

Closed justin-hackin closed 3 years ago

justin-hackin commented 3 years ago

This repository demonstrates that when a component with react-router-dom hooks is rendered within a Route, the application throws an error suggesting the rules of hooks have been violated. This repository shows the same App is working in the context of a create-react-app.

In order to reproduce the issue, click the "About" link in the app. In the working example, a button is rendered and clicking on it changes the route to the Topics section. In the bugged example, the app crashes.

Variations that did not prove any fix:

loopmode commented 3 years ago

Please search the existing issues. There's plenty similar ones. If you wanna get there more quickly or directly, search for "whitelisting".

justin-hackin commented 3 years ago

Yes, adding the package react-router-dom to the whitelist fixed my issue, I had searched issues on the react-router-dom but forgot to take a closer look here , thanks for identifying the dupe

loopmode commented 3 years ago

If I only had a dime for every time someone faces this issue 🙂