File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
packages/eslint-plugin-react-hooks Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1755,6 +1755,17 @@ const allTests = {
17551755 } ,
17561756 errors : [ useEffectEventError ( 'onClick' , true ) ] ,
17571757 } ,
1758+ {
1759+ code : normalizeIndent `
1760+ function MyComponent({ theme }) {
1761+ const onClick = React.useEffectEvent(() => {
1762+ showNotification(theme);
1763+ });
1764+ return <Child onClick={onClick}></Child>;
1765+ }
1766+ ` ,
1767+ errors : [ useEffectEventError ( 'onClick' , false ) ] ,
1768+ } ,
17581769 {
17591770 code : normalizeIndent `
17601771 function MyComponent({ theme }) {
Original file line number Diff line number Diff line change @@ -235,7 +235,9 @@ const rule = {
235235 parent . init &&
236236 parent . init . type === 'CallExpression' &&
237237 parent . init . callee &&
238- isUseEffectEventIdentifier ( parent . init . callee )
238+ isUseEffectEventIdentifier (
239+ getNodeWithoutReactNamespace ( parent . init . callee ) ,
240+ )
239241 ) {
240242 if ( reference . resolved === null ) {
241243 throw new Error ( 'Unexpected null reference.resolved' ) ;
You can’t perform that action at this time.
0 commit comments