We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2275a73 commit f5b14bbCopy full SHA for f5b14bb
1 file changed
apps/landing/src/hooks/use-scroll-top.ts
@@ -0,0 +1,13 @@
1
+'use client'
2
+import { useLenis } from 'lenis/react'
3
+import { usePathname } from 'next/navigation'
4
+import { useEffect } from 'react'
5
+
6
+export function useScrollToTop() {
7
+ const pathname = usePathname()
8
+ const lenis = useLenis()
9
10
+ useEffect(() => {
11
+ lenis?.scrollTo(0, { immediate: true })
12
+ }, [lenis, pathname])
13
+}
0 commit comments