Skip to content

Commit

Permalink
chore: change the correct hook
Browse files Browse the repository at this point in the history
  • Loading branch information
thebuilder committed Dec 14, 2024
1 parent 54cc68e commit bd8de3a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/useInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export function useInView({
onChange,
}: IntersectionOptions = {}): InViewHookResponse {
const [ref, setRef] = React.useState<Element | null>(null);
const callback = React.useRef<IntersectionOptions["onChange"] | undefined>(
onChange,
);
const callback = React.useRef<IntersectionOptions["onChange"]>(onChange);
const [state, setState] = React.useState<State>({
inView: !!initialInView,
entry: undefined,
Expand Down Expand Up @@ -115,7 +113,7 @@ export function useInView({
);

const entryTarget = state.entry?.target;
const previousEntryTarget = React.useRef<Element>(undefined);
const previousEntryTarget = React.useRef<Element>(null);
if (
!ref &&
entryTarget &&
Expand Down

0 comments on commit bd8de3a

Please sign in to comment.