Closed lequan81 closed 1 year ago
Using react-router-dom
's BrowserRouter? Electron does not handle history and works with the synchronized URL, so BrowserRouter
does not work with Electron. Use HashRouter
instead of BrowserRouter
to sync URL with UI (windows.location.hash).
Thank you for your advice, @alex8088. I have already changed BrowserRouter
to HashRouter
, but it seems the problem still exists. I have two components, one is List
and another is NavbarHeader
, but for some reason when I use useContext hooks in the List
component, it works fine, but if I use useContext hooks for both the List
and Navbar
components, I get an error as I mentioned above.
Is the problem solved?
I'm sorry to reply to you this late.
Nah, I'm now using props
instead of useContext
hooks as a workaround for my problems, and although kind of dirty, it works at least. If I still can not figure out what was wrong, I will update you with a demo of the error as soon as possible.
ps: Due to my tight final exam schedule for the next 3 weeks, I might not be active for a couple of days :<
Describe the bug
I want to use useContext hooks in my app. It works well on Reactjs using
yarn create vite my-react-app --template react
command, but have some error warnings inelectron-vite
usingreact
andreact-router-dom
packageHere is a working demo: https://bdoui0.csb.app/
my app tree looks like this:
context.js file
Classes.jsx file
NavbarHeader.jsx file
ClassList.jsx file
error
message in Developer ToolsElectron-Vite Version
1.0.21
Electron Version
22.3.4
Vite Version
4.2.1
Validations