Skip to content

Commit

Permalink
refactor: ScrollTop 컴포넌트 useLayoutEffect 사용하게 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwl98 committed Nov 23, 2023
1 parent e57ec81 commit 74e2768
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/ScrollTop.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect } from 'react';
import { useLayoutEffect } from 'react';
import { useLocation } from 'react-router-dom';

export const ScrollTop = () => {
const location = useLocation();

useEffect(() => {
useLayoutEffect(() => {
window.scrollTo({ top: 0 });
}, [location]);

Expand Down

0 comments on commit 74e2768

Please sign in to comment.