refactor: revert to useCallback for ref
refactor: revert to useCallback for ref

Change it so cleanup is now done inside a `useEffect`. This allows the `setRef` to be called multiple times before the hook triggers the cleanup, ensuring the current `ref` is settled.

thebuilder/react-intersection-observer,thebuilder/react-intersection-observer,thebuilder/react-intersection-observer