Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useIntersection warning with React 19 #2612

Open
clacladev opened this issue Dec 13, 2024 · 2 comments
Open

useIntersection warning with React 19 #2612

clacladev opened this issue Dec 13, 2024 · 2 comments

Comments

@clacladev
Copy link

What is the current behavior?
Migrating to Nextjs 15.1 and React 19, the useIntersection started to throw a ts warning.

The code in the docs does not work anymore.

const intersectionRef = React.useRef(null);
const intersection = useIntersection(intersectionRef, { ... }); <<< intersectionRef

The error is:

Argument of type 'RefObject<null>' is not assignable to parameter of type 'RefObject<HTMLElement>'.
  Type 'null' is not assignable to type 'HTMLElement'.ts(2345)

useIntersection signature should accept RefObject<HTMLElement | null>.

What is the expected behavior?
To not throw a warning. It actually keeps working.

A little about versions:

  • OS: macOS 15.1.1
  • Browser (vendor and version): Chrome 131
  • React: 19
  • react-use: 17.5.1
  • Did this worked in the previous package version? No
@theRuslan
Copy link

The same issue with useFullscreen

@hqw567
Copy link

hqw567 commented Dec 21, 2024

The same issue with useHoverDirty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants