-
-
Notifications
You must be signed in to change notification settings - Fork 28
Fix landing #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix landing #15
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 🚀 New features to boost your workflow:
|
| 'use client' | ||
|
|
||
| import { useEffect, useState } from 'react' | ||
|
|
||
| export const useViewportSize = () => { | ||
| const [viewportSize, setViewportSize] = useState({ | ||
| width: 0, | ||
| height: 0, | ||
| }) | ||
|
|
||
| useEffect(() => { | ||
| const handleResize = () => { | ||
| setViewportSize({ | ||
| width: window.innerWidth, | ||
| height: window.innerHeight, | ||
| }) | ||
| } | ||
|
|
||
| window.addEventListener('resize', handleResize) | ||
| handleResize() | ||
|
|
||
| return () => window.removeEventListener('resize', handleResize) | ||
| }, []) | ||
|
|
||
| return viewportSize | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제거해도 되는 훅으로 보입니다
| 'use client' | ||
|
|
||
| import { useEffect, useState } from 'react' | ||
|
|
||
| export const useBoundingClientRect = ( | ||
| ref: React.RefObject<HTMLElement | null>, | ||
| ) => { | ||
| const [rect, setRect] = useState<DOMRect | null>(null) | ||
|
|
||
| useEffect(() => { | ||
| if (ref.current) { | ||
| setRect(ref.current.getBoundingClientRect()) | ||
| } | ||
| }, [ref]) | ||
|
|
||
| return rect | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제거해도 되는 훅으로 보입니다
No description provided.