refs.setFloating triggering React Compiler lint error "Cannot access refs during render"
#3405
-
|
The docs on <div ref={refs.setFloating}/>This usage triggers a lint error "Cannot access refs during render" from the new rule I wonder, is this a false-positive or is it a bug in this library? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
It's a false positive in the lint rule Seems like there's a bug with how refs are inferred: react/react#34775 |
Beta Was this translation helpful? Give feedback.
-
|
Same lint error happens for when using useListNavigation |
Beta Was this translation helpful? Give feedback.
It's a false positive in the lint rule
refsis a plain object andsetFloatingis a state setter (used as a callback ref). No refs are being read in render.Seems like there's a bug with how refs are inferred: react/react#34775