Skip to content

Commit

Permalink
Replace useEffect with useLayoutEffect (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
1ilit committed Apr 10, 2024
1 parent 6ab13a7 commit 13897e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
import { useLayoutEffect } from "react";
import Editor from "./pages/Editor";
import Survey from "./pages/Survey";
import BugReport from "./pages/BugReport";
import Shortcuts from "./pages/Shortcuts";
import Templates from "./pages/Templates";
import { useEffect, useLayoutEffect } from "react";
import LandingPage from "./pages/LandingPage";
import SettingsContextProvider from "./context/SettingsContext";
import useSettings from "./hooks/useSettings";
Expand Down Expand Up @@ -82,7 +82,7 @@ function ThemedPage({ children }) {

function RestoreScroll() {
const location = useLocation();
useEffect(() => {
useLayoutEffect(() => {
window.scroll(0, 0);
}, [location.pathname]);
return null;
Expand Down

0 comments on commit 13897e7

Please sign in to comment.