--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: checkHooksImportedFromReact.js --- # Input ```jsx function MyComponent1() { let a = 1; React.useEffect(() => { console.log(a); }, []); // the rule doesn't show the warnings because the hooks are not imported from react. useEffect(() => { console.log(a); }, []); } function MyComponent2() { let a = 1; const React = { useEffect() {} } // the rule doesn't show the warnings because `React` is defined by the user. React.useEffect(() => { console.log(a); }, []); } ``` # Diagnostics ``` checkHooksImportedFromReact.js:3:9 lint/correctness/useExhaustiveDependencies ━━━━━━━━━━━━━━━━━━━━━━ ! This hook does not specify all of its dependencies: a 1 │ function MyComponent1() { 2 │ let a = 1; > 3 │ React.useEffect(() => { │ ^^^^^^^^^ 4 │ console.log(a); 5 │ }, []); i This dependency is not specified in the hook dependency list. 2 │ let a = 1; 3 │ React.useEffect(() => { > 4 │ console.log(a); │ ^ 5 │ }, []); 6 │ i Either include it or remove the dependency array ```