File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
packages/eslint-plugin-react-hooks/__tests__ Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -7491,6 +7491,33 @@ const tests = {
7491
7491
} ,
7492
7492
] ,
7493
7493
} ,
7494
+ {
7495
+ code : normalizeIndent `
7496
+ function Foo() {
7497
+ const foo = {};
7498
+ useLayoutEffect(() => {
7499
+ console.log(foo);
7500
+ }, [foo]);
7501
+ useEffect(() => {
7502
+ console.log(foo);
7503
+ }, [foo]);
7504
+ }
7505
+ ` ,
7506
+ errors : [
7507
+ {
7508
+ message :
7509
+ "The 'foo' object makes the dependencies of useLayoutEffect Hook (at line 6) change on every render. " +
7510
+ "To fix this, wrap the initialization of 'foo' in its own useMemo() Hook." ,
7511
+ suggestions : undefined ,
7512
+ } ,
7513
+ {
7514
+ message :
7515
+ "The 'foo' object makes the dependencies of useEffect Hook (at line 9) change on every render. " +
7516
+ "To fix this, wrap the initialization of 'foo' in its own useMemo() Hook." ,
7517
+ suggestions : undefined ,
7518
+ } ,
7519
+ ] ,
7520
+ } ,
7494
7521
] ,
7495
7522
} ;
7496
7523
You can’t perform that action at this time.
0 commit comments