import { useEffect, useRef } from 'react' export const RevealFade: React.FC = (props) => { const { children } = props const htmlElement = useRef(null) useEffect(() => { const observer = new window.IntersectionObserver( (entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add('reveal-visible') observer.unobserve(entry.target) } }) }, { root: null, rootMargin: '0px', threshold: 0.28 } ) observer.observe(htmlElement.current as HTMLDivElement) }, []) return ( <>
{children}
) }