in App.js:
return (
<BrowserRouter basename="/">
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/home" element={<Home />} />
<Route exact path="/header" element={<div><Header links={"/"}/><Me /><Footer /></div>} />
<Route exact path="/me" element={<div><Header links={"/"}/><Me /><Footer /></div>} />
<Route exact path="/About" element={<div><Header links={"/"}/> <About /> <Footer /></div>} />
<Route exact path="/projects" element={<div><Header links={"/"}/> <Projects /> <Footer /></div>} />
<Route exact path="/skills" element={<div><Header links={"/"}/> <Skills /> <Footer /></div>} />
<Route exact path="/contact" element={<div><Header links={"/"}/> <Contact /> <Footer /></div>} />
<Route path="*" element={<ErrorPage />} />
</Routes>
</BrowserRouter>
);
}
This is working correctly at localhost, and first deploy was working.
I haven't change app.js and I fix some bugs When I deployed, then it haven't work again.
Now I am deploying to github with npm run deploy
, only home page is working.
in package.json:
{
"homepage": "http://ayazvefa.dev/",
"name": "vefa-ayaz",
"version": "1.0.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"aos": "^3.0.0-beta.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.9.0",
"react-script-tag": "^1.1.2",
"react-scripts": "5.0.1",
"typed.js": "^2.0.132",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
and here to source code and here to website link
I don't know where is the problem, I use hashrouter(it was working(/#/)), I added basename(website link, "/") and it wasn't working again Where is the problem? why browserrouter wont work?