vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.41k stars 27.03k forks source link

[Link Component] Accessing element.ref was removed in React 19 #72873

Open gagzu opened 2 weeks ago

gagzu commented 2 weeks ago

Link to the code that reproduces this issue

https://github.com/gagzu/nextjs-issue-link-component-example

To Reproduce

To reproduce the error:

Current vs. Expected behavior

The error I'm getting is: "Accessing element.ref was removed in React 19." The error is due to the Link component using forwardRef.

The expected result is: Not seeing any error in the console.

Provide environment information

information about my environment:
Operating System:
  Platform: linux
  Arch: x64
  Version: #135~20.04.1-Ubuntu SMP Mon Oct 7 13:56:22 UTC 2024
  Available memory (MB): 15871
  Available CPU cores: 4
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.0.4-canary.13 // Latest available version is detected (15.0.4-canary.13).
  eslint-config-next: 15.0.3
  react: 19.0.0-rc.1
  react-dom: 19.0.0-rc.1
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Navigation

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

No response

gabriez commented 1 week ago

I'm getting the same error using ref

Fatima-yo commented 1 week ago

Do you plan to fix this error soon? I have the same problem.

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!