Skip to content

[Compiler]: Ref values (the current property) may not be accessed during render - showing error message for custom hooks #30745

@gkiely

Description

@gkiely

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-compiler (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://github.com/gkiely/react-eslint-vite

Repro steps

git clone https://github.com/gkiely/react-eslint-vite
npm i 
npm run lint

Each of these show an error message:

  • Pass a ref to a custom hook
  • Set ref.current inside a useCallback and pass to a custom hook
  • useImperativeHandle

How often does this bug happen?

Every time

What version of React are you using?

19.0.0-rc-6ebfd5b0-20240818

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions