Skip to content

If I pass a NodeListOf<HTMLElement> to the InView function, is an Intersection Observer created for each Element or is a general one created? #3054

Answered by mattgperry
UlssCrts asked this question in Q&A
Discussion options

You must be logged in to vote

Each inView() makes just one observer per call, no matter how many elements are passed. By contrast, useInView and whileInView make theoretically minimum number of observers across all calls - at some point I’d like to bring this further optimisation to inView() but that depends on how much extra filesize it brings and if it’s worth it.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@UlssCrts
Comment options

Answer selected by UlssCrts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants