diff --git a/packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js b/packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js index 4de51e9c4043a..6f153eac9d11f 100644 --- a/packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js +++ b/packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js @@ -279,6 +279,18 @@ const tests = { } `, }, + { + code: normalizeIndent` + function MyComponent() { + const x = true ? { test: true } : undefined; + React.useEffect(() => { + if (x?.test) { + console.log("testing"); + } + }, [x?.test]); + } + `, + }, { code: normalizeIndent` function MyComponent(props) {