We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2f1f22 commit d51c0b6Copy full SHA for d51c0b6
src/App.js
@@ -12,11 +12,22 @@ import {
12
HashRouter as Router,
13
Route,
14
Routes,
15
- Navigate
+ Navigate,
16
+ useLocation
17
} from "react-router-dom";
18
import "./App.css";
19
import "bootstrap/dist/css/bootstrap.min.css";
20
21
+function ScrollToTop() {
22
+ const { pathname } = useLocation();
23
+
24
+ useEffect(() => {
25
+ window.scrollTo(0, 0);
26
+ }, [pathname]);
27
28
+ return null;
29
+}
30
31
function App() {
32
const [load, upadateLoad] = useState(true);
33
@@ -30,6 +41,7 @@ function App() {
41
42
return (
43
<Router>
44
+ <ScrollToTop />
45
<LoadingAnimation load={load} />
34
46
<div className="App" id={load ? "no-scroll" : "scroll"}>
35
47
<Navbar />
0 commit comments