I’m using electron-forge with react and I’m trying to set up routing using HashRouter in my app using react-router-dom. My app uses links in the sidebar to navigate through the various routes. I tried to set up a HashRouter in the app and no errors pop up when compiling, but nothing shows up when the code is running. All the pages that it links to are blank and the components aren’t displayed.
I suspect this might be because electron-forge is hosting my app on localhost:3000/main_window instead of localhost:3000/ itself. Is there any way I can host the app on localhost:3000/ itself or is there an additional step in setting up HashRouters as compared to BrowserRouters in react-router-dom?
This is how the Routes were set up:
<HashRouter>
<Routes>
<Route path="/" exact component={Home} />
<Route path="/classes/:classId" component={ViewClass} />
<Route path="/addClass" component={AddClass} />
</Routes>
</HashRouter>
This is the button with the link to the Home Route:
<button className="nav-icon">
<FontAwesomeIcon icon={solid('home')} />
<Link className="nav-icon-text" to="/">Home</Link>
</button>
When the app starts, it automatically hosts to localhost:3000/main_window and nothing is shown. When the sidebar button is pressed, it links to localhost:3000/main_window#/ which doesn’t show anything either.
Does anyone know what the problem is here?