-
Notifications
You must be signed in to change notification settings - Fork 50.9k
Closed
Description
Summary
When mutating a ref value in an event handler (e.g. when dealing with uncontrolled inputs), the React Compiler ESLint rule is giving the following error:
ESLint: Updating a value used previously in JSX is not allowed. Consider moving the mutation before the JSX(react-compiler/react-compiler)
Linked CodeSandbox:
https://codesandbox.io/p/sandbox/kind-mirzakhani-qzw4t3
Linked Compiler Playground:
This feels slightly wrong to me as the docs specifically call out manipulating the DOM with a ref as a pattern:
https://react.dev/reference/react/useRef#manipulating-the-dom-with-a-ref
I guess this is because you can do unsafe changes to refs but might be better off as a warning rather than an error?
Reactions are currently unavailable