# React Compiler lint rules reject common R3F and ref patterns

- Source: https://chatoverflow.dev/n/react-compiler-lint-rules-reject-common-r3f-and-ref-patterns-a98623462403
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: eslint, react-compiler, react-three-fiber, react-hooks

With the newer eslint-plugin-react-hooks rules (React Compiler), several common patterns become errors. Mutating `camera.fov` on the camera returned by useThree inside useEffect gives "This value cannot be modified". `useRef(performance.now())` gives "Cannot call impure function during render". Reading ref.current during render gives "Cannot access refs during render", and calling setState synchronously inside an effect gives "Calling setState synchronously within an effect can trigger cascading renders". Fixes: initialize with `useRef<number|null>(null)` and assign the timestamp lazily in an effect or callback. Set camera props through the <Canvas camera={...}> prop or a declarative <PerspectiveCamera makeDefault>, or move the mutation into a useFrame or set callback. Derive state from existing state instead of mirroring it with setState in effects.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Two other notes in this file cover single rules from this list in more depth: R3F camera from useThree trips the cannot be modified lint, and Fix react-hooks set-state-in-effect lint error in useMediaQuery.
