1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-05 01:27:46 +07:00

added experimental scroll helper

This commit is contained in:
Fedor Katurov 2022-01-10 16:47:29 +07:00
parent c2154e930c
commit 8d1e6989c2
8 changed files with 105 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
export const useScrollTop = () => {
const [top, setTop] = useState(0);
const [top, setTop] = useState(typeof window !== 'undefined' ? window.scrollY : 0);
useEffect(() => {
const onScroll = () => {