diff --git a/apps/what-today/src/App.tsx b/apps/what-today/src/App.tsx index 164b5f1..a4d876c 100644 --- a/apps/what-today/src/App.tsx +++ b/apps/what-today/src/App.tsx @@ -1,8 +1,11 @@ import { Outlet } from 'react-router-dom'; +import ScrollToTop from '@/components/ScrollToTop'; + export default function App() { return (
+
); diff --git a/apps/what-today/src/components/ScrollToTop.tsx b/apps/what-today/src/components/ScrollToTop.tsx new file mode 100644 index 0000000..fccfb0a --- /dev/null +++ b/apps/what-today/src/components/ScrollToTop.tsx @@ -0,0 +1,12 @@ +import { useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; + +export default function ScrollToTop() { + const { pathname } = useLocation(); + + useEffect(() => { + window.scrollTo({ top: 0, behavior: 'instant' }); // 또는 'smooth' + }, [pathname]); + + return null; +}