refactor(use-intersection): remove useRef usage (#39791)
refactor(use-intersection): remove useRef usage (#39791)

The PR neither fixes a bug nor introduces a new feature. It just makes the current code be more clearer.

We track the `unobserve` method (to clear the side-effect) in a ref before this PR which is not required anymore:

- The `unobserve` method can only be created during the `useEffect`
- The `unobserve` method will be called during `useEffect` cleans up.

In short, the "life cycle" of the `unobserve` method now only lives inside the `useEffect`. So we can remove the usage of `useRef`.
JeromeFitz/next.js,JeromeFitz/next.js,JeromeFitz/next.js,JeromeFitz/next.js