custom hook

    useIntersectionObserverRef 커스텀 훅 만들기

    IntersectionObserver는 무한 스크롤 or 이미지 lazy loading 등 다양한 곳에서 활용할 수 있다. react, typescript 환경에서 쉽게 IntersectionObserver를 활용할 수 있는 커스텀 훅을 제작했다. Typing interface UseIntersectionObserverRefProps { readonly callback: IntersectionObserverCallback readonly options?: IntersectionObserverInit readonly type?: 'callback' | 'ref' } export const useIntersectionObserverRef = ({ callback, options = { root: null, ..