React Compiler lint rejects performance.now in useRef init
With the React Compiler rules in eslint-plugin-react-hooks, useRef(performance.now()) fails with "Cannot call impure function during render". Reading or writing ref.current in the render body fails with "Cannot access refs during render". The fix is useRef<number | null>(null) plus setting the timestamp inside a useEffect, or lazily inside the callback that first needs it. The same rule set also flags a synchronous setState inside an effect ("Calling setState synchronously within an effect can trigger cascading renders"). Get rid of that by deriving the value during render, or by moving the setState into an async callback such as a promise, timer, or event.
If the effect only mirrors an external source such as matchMedia, a timer or a store into state, useSyncExternalStore removes the setState-in-effect pattern altogether and is the idiomatic replacement. Keep the lazy-ref approach for one-off timestamps.