diff --git a/src/components/ProjectsPage.js b/src/components/ProjectsPage.js index d389142..12b5de3 100644 --- a/src/components/ProjectsPage.js +++ b/src/components/ProjectsPage.js @@ -16,6 +16,10 @@ const ProjectsPage = ({ projects }) => { setCurrentPage(data.selected); }; + useEffect(() => { + window.scrollTo(0, 0); + }, [currentPage]); + const indexOfLastProject = (currentPage + 1) * projectsPerPage; const indexOfFirstProject = indexOfLastProject - projectsPerPage; const currentProjects = projects.slice(indexOfFirstProject, indexOfLastProject); diff --git a/src/components/blog/blogList.jsx b/src/components/blog/blogList.jsx index da75970..6618dcf 100644 --- a/src/components/blog/blogList.jsx +++ b/src/components/blog/blogList.jsx @@ -35,6 +35,11 @@ const BlogList = () => { const currentBlogs = blogs.slice(indexOfFirstProject, indexOfLastProject); const pageCount = Math.ceil(blogs.length / blogsPerPage); + useEffect(() => { + window.scrollTo(0, 0); + }, [currentPage]); + + return ( <>
diff --git a/src/components/event/eventList.jsx b/src/components/event/eventList.jsx index 9a750f8..e7049b1 100644 --- a/src/components/event/eventList.jsx +++ b/src/components/event/eventList.jsx @@ -36,6 +36,10 @@ const EventList = () => { setCurrentPage(data.selected); }; + useEffect(() => { + window.scrollTo(0, 0); + }, [currentPage]); + return ( <>