Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

571
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda