I built an app with vite react router. I pushed it to github pages and got some error. I read about github pages doesn’t support browserrouter, so I changed it to hashrouter, but still not working. This is the code for it.
import React from 'react';
import { HashRouter as HashRouter, Routes, Route } from 'react-router-dom';
import HomePage from './pages/HomePage';
import HeroesPage from './pages/HeroesPage';
export default function App() {
return (
<HashRouter>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/HeroesPage" element={<HeroesPage />} />
</Routes>
</HashRouter>
);
}
Maybe I made mistakes when use hashrouter. I dont know where I should start search for the mistake. Is there any issue with the way I imported and implemented hashrouter or the path?