Skip to content

Commit 13897e7

Browse files
committed
Replace useEffect with useLayoutEffect (#23)
1 parent 6ab13a7 commit 13897e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/App.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
2+
import { useLayoutEffect } from "react";
23
import Editor from "./pages/Editor";
34
import Survey from "./pages/Survey";
45
import BugReport from "./pages/BugReport";
56
import Shortcuts from "./pages/Shortcuts";
67
import Templates from "./pages/Templates";
7-
import { useEffect, useLayoutEffect } from "react";
88
import LandingPage from "./pages/LandingPage";
99
import SettingsContextProvider from "./context/SettingsContext";
1010
import useSettings from "./hooks/useSettings";
@@ -82,7 +82,7 @@ function ThemedPage({ children }) {
8282

8383
function RestoreScroll() {
8484
const location = useLocation();
85-
useEffect(() => {
85+
useLayoutEffect(() => {
8686
window.scroll(0, 0);
8787
}, [location.pathname]);
8888
return null;

0 commit comments

Comments
 (0)