DEV Community

Discussion on: Intersection Observer using React

Collapse
 
timzzz19 profile image
TimZZZ19

Is the containnerRef supposed to change everytime the component rerenders? So the useEffect hook will execute because the change of containerRef?

Collapse
 
isumix profile image
I Su • Edited

Nope, the containerRef will not trigger useEffect and should not be used in the dependencies, The above example is not entirely correct. For more details, please refer to this article medium.com/@teh_builder/ref-object...