react-vite-themes
Version:
A test/experimental React theme system created for learning purposes. Features atomic design components, SCSS variables, and dark/light theme support. Not intended for production use.
15 lines (14 loc) • 406 B
JavaScript
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
export const ScrollToTop = () => {
const { pathname } = useLocation();
useEffect(() => {
// Instant jump to top when pathname changes (no smooth animation)
window.scrollTo({
top: 0,
left: 0,
behavior: 'instant'
});
}, [pathname]);
return null;
};