diff --git a/src/useInView.tsx b/src/useInView.tsx index e148eac3..ed14b080 100644 --- a/src/useInView.tsx +++ b/src/useInView.tsx @@ -46,9 +46,7 @@ export function useInView({ onChange, }: IntersectionOptions = {}): InViewHookResponse { const [ref, setRef] = React.useState(null); - const callback = React.useRef( - onChange, - ); + const callback = React.useRef(onChange); const [state, setState] = React.useState({ inView: !!initialInView, entry: undefined, @@ -115,7 +113,7 @@ export function useInView({ ); const entryTarget = state.entry?.target; - const previousEntryTarget = React.useRef(undefined); + const previousEntryTarget = React.useRef(null); if ( !ref && entryTarget &&