Follow-up
This commit is contained in:
parent
fbda463306
commit
a7f79f99d6
@ -170,9 +170,11 @@ export function useIntersectionObserver({
|
||||
export function useOnIntersect(
|
||||
targetRef: RefObject<HTMLDivElement>, observe?: ObserveFn, callback?: TargetCallback,
|
||||
) {
|
||||
const lastCallback = useLastCallback(callback);
|
||||
|
||||
useEffect(() => {
|
||||
return observe ? observe(targetRef.current!, callback) : undefined;
|
||||
}, [callback, observe, targetRef]);
|
||||
return observe ? observe(targetRef.current!, lastCallback) : undefined;
|
||||
}, [lastCallback, observe, targetRef]);
|
||||
}
|
||||
|
||||
export function useIsIntersecting(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user