Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

570
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!