Skip to content

Commit

Permalink
feat: scroll 고정 훅
Browse files Browse the repository at this point in the history
  • Loading branch information
jieunpark247 committed Jul 7, 2023
1 parent 3f8836d commit b730778
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export { default as useIntersectObserver } from './useIntersectObserver/useInter
export { default as useOverlay } from './useOverlay/useOverlay';

export { default as useClipBoard } from './useClipBoard/useClipBoard';

export { default as useLockScroll } from './useLockScroll/useLockScroll';
12 changes: 12 additions & 0 deletions src/hooks/useLockScroll/useLockScroll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useLayoutEffect } from 'react';

const useLockScroll = () => {
useLayoutEffect(() => {
document.body.style.overflow = 'hidden';
return () => {
document.body.style.overflow = 'unset';
};
}, []);
};

export default useLockScroll;

0 comments on commit b730778

Please sign in to comment.