MCPcopy
hub / github.com/thebuilder/react-intersection-observer / cleanupExisting

Function cleanupExisting

src/useOnInView.tsx:72–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 // React <19 never calls ref callbacks with `null` during unmount, so we
71 // eagerly tear down existing observers manually whenever the target changes.
72 const cleanupExisting = () => {
73 if (observerCleanupRef.current) {
74 const cleanup = observerCleanupRef.current;
75 observerCleanupRef.current = undefined;
76 cleanup();
77 }
78 };
79
80 if (element === observedElementRef.current) {
81 return observerCleanupRef.current;

Callers 1

useOnInViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…