Verified Solution[facebook/react] [eslint-plugin-react-hooks] Bug: `react-hooks/refs` rule reporting false positive
Sponsored Content
### ROOT CAUSE
The `react-hooks/refs` ESLint rule incorrectly flags references when accessed via object properties, mistaking them for `ref.current` accesses. This happens because the rule doesn't properly handle object destructuring or direct ref assignment.
### CODE FIX
To resolve the false positive, wrap the ref access in an Immediately Invoked Function Expression (IIFE) to ensure the rule correctly identifies it as a proper ref assignment.
```ts
function App() {
const groupRefs = {
group1: React.useRef(null),
group2: React.useRef(null),
};
return (
groupRefs.group1)()}
headerText="Group 1"
>
groupRefs.group2)()}
headerText="Group 2"
>
);
}
```
Deploy on DigitalOcean ($200 Credit)
Related Fixes
[microsoft/vscode] Copilot chat OTel instruction message JSON doesn't follow the standard
[gitlab-org/gitlab] Reaction picker has two vertical scrollbars
[rust-lang/rust] SIGSEGV in rustc when using #[link_name = "llvm.aarch64.rndrrs"]