Skip to content

feat: add ScrollToTop component to scroll to top on route change - #41

Open
sayali-git-hub wants to merge 3 commits into
Vikram-sardiwal:mainfrom
sayali-git-hub:feature/scroll-to-top
Open

sayali-git-hub wants to merge 3 commits into
Vikram-sardiwal:mainfrom
sayali-git-hub:feature/scroll-to-top

Conversation

@sayali-git-hub

Copy link
Copy Markdown

What changes were made

  • Created a reusable ScrollToTop component in src/components/ScrollToTop.jsx
  • Used useEffect and useLocation from React Router to detect route changes
  • Scrolls window to top on every route change
  • Added ScrollToTop to App.jsx so it works across all routes

Related Issue

Closes #20

How to test

  • Navigate between pages using the navbar links
  • The page will automatically scroll to the top on each route change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Scroll-to-Top on Route Change

1 participant