mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added experimental scroll helper
This commit is contained in:
parent
c2154e930c
commit
8d1e6989c2
8 changed files with 105 additions and 4 deletions
10
src/hooks/dom/useScrollToBottom.ts
Normal file
10
src/hooks/dom/useScrollToBottom.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { useCallback } from 'react';
|
||||
import { useScrollHeight } from '~/hooks/dom/useScrollHeight';
|
||||
|
||||
export const useScrollToBottom = () => {
|
||||
const top = useScrollHeight();
|
||||
|
||||
return useCallback(() => {
|
||||
window.scrollTo({ top });
|
||||
}, [top]);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue