File tree 1 file changed +29
-29
lines changed
packages/eslint-plugin-react-hooks/__tests__ 1 file changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -1387,7 +1387,7 @@ const tests = {
1387
1387
code : normalizeIndent `
1388
1388
function useFoo(){
1389
1389
const foo = "hi!";
1390
- return useMemo(() => foo, [foo]);
1390
+ return useMemo(() => foo, [foo]);
1391
1391
}
1392
1392
` ,
1393
1393
} ,
@@ -5797,20 +5797,20 @@ const tests = {
5797
5797
] ,
5798
5798
} ,
5799
5799
{
5800
- code : normalizeIndent `
5801
- function MyComponent(props) {
5802
- let handleNext = () => {
5803
- console.log('hello');
5804
- };
5805
- if (props.foo) {
5806
- handleNext = () => {
5807
- console.log('hello');
5808
- };
5809
- }
5810
- useEffect(() => {
5811
- return Store.subscribe(handleNext);
5812
- }, [handleNext]);
5813
- }
5800
+ code : normalizeIndent `
5801
+ function MyComponent(props) {
5802
+ let handleNext = () => {
5803
+ console.log('hello');
5804
+ };
5805
+ if (props.foo) {
5806
+ handleNext = () => {
5807
+ console.log('hello');
5808
+ };
5809
+ }
5810
+ useEffect(() => {
5811
+ return Store.subscribe(handleNext);
5812
+ }, [handleNext]);
5813
+ }
5814
5814
` ,
5815
5815
errors : [
5816
5816
{
@@ -5826,20 +5826,20 @@ const tests = {
5826
5826
{
5827
5827
desc :
5828
5828
"Wrap the construction of 'handleNext' in its own useCallback() Hook." ,
5829
- output : normalizeIndent `
5830
- function MyComponent(props) {
5831
- let handleNext = useCallback(() => {
5832
- console.log('hello');
5833
- });
5834
- if (props.foo) {
5835
- handleNext = () => {
5836
- console.log('hello');
5837
- };
5838
- }
5839
- useEffect(() => {
5840
- return Store.subscribe(handleNext);
5841
- }, [handleNext]);
5842
- }
5829
+ output : normalizeIndent `
5830
+ function MyComponent(props) {
5831
+ let handleNext = useCallback(() => {
5832
+ console.log('hello');
5833
+ });
5834
+ if (props.foo) {
5835
+ handleNext = () => {
5836
+ console.log('hello');
5837
+ };
5838
+ }
5839
+ useEffect(() => {
5840
+ return Store.subscribe(handleNext);
5841
+ }, [handleNext]);
5842
+ }
5843
5843
` ,
5844
5844
} ,
5845
5845
] ,
You can’t perform that action at this time.
0 commit comments