Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

useIntersection warning with React 19

Abierto
#2,612 5 comentarios 28 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
nextjs, react, typescript
Área
frontend

Línea de trabajo

Start with docs/useIntersection.md and follow the useIntersection signature used by its example. Update the accepted ref type so the documented React 19 example type-checks without a warning, then verify the example and related package checks pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
44k
Forks
3.3k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de streamich/react-use

Todos los issues de streamich/react-use

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.