Skip to content

Commit

Permalink
refactor(useInViewport): el is not empty (alibaba#2476)
Browse files Browse the repository at this point in the history
  • Loading branch information
coding-ice authored Feb 26, 2024
1 parent 39284dc commit 8eb174a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/hooks/src/useInViewport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ function useInViewport(target: BasicTarget | BasicTarget[], options?: Options) {
},
);

els.forEach((el) => {
if (el) {
observer.observe(el);
}
});
els.forEach((el) => observer.observe(el!));

return () => {
observer.disconnect();
Expand Down

0 comments on commit 8eb174a

Please sign in to comment.