"Avoiding recreating the ref contents" disallowed by compiler lint #20
yepitschunked
started this conversation in
Something went wrong
Replies: 1 comment
-
Sorry it took us so long to address this! The compiler previously wasn't able to support this pattern because it didn't recognize a distinction between safely avoiding recreating the ref contents and arbitrary, unsafe reading and writing of refs. We just landed facebook/react#31188, which should address this issue and allow this pattern to work without signaling an error or bailing out the compiler. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The ref docs have a section on avoiding recreating the ref contents by doing something like this: https://react.dev/reference/react/useRef#avoiding-recreating-the-ref-contents
This fails the react compiler eslint check with
Ref values (the
currentproperty) may not be accessed during render. (https://react.dev/reference/react/useRef)
. Is this intentional?Beta Was this translation helpful? Give feedback.
All reactions