function Image(props) {
const ref = useRef(null); // ✅ IntersectionObserver is created lazily once
function getObserver() {
if (ref.current === null) {
ref.current = new IntersectionObserver(onIntersect);
}
return ref.current;
} // When you need it, call getObserver() // ...}