Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

573
Vistas
NextJS > Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

I'm trying to wrap a card component using the Link component from 'next/link'. When I click the card it should have taken me to the link but it's not doing that. instead, I'm getting a warning ' Function components cannot be given refs. Attempts to access this ref will fail'. How can I fix this?

here's the code:

<div className="flex justify_between align_center flex_wrap mb_2 ">
    {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((item) => (
      <Link href="/blog-details" key={item}>
        <BlogCard />
      </Link>
    ))}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your question is actually stated in the official documentation. You probably need to check out all the cases to see which case you are fall in. It highly depends on your <BlogCard /> structure. Then you can forward the href and ref to your custom component.

https://nextjs.org/docs/api-reference/next/link#if-the-child-is-a-functional-component

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda