Skip to content

Commit

Permalink
Add test with a valid hook call outside of a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Dec 10, 2024
1 parent 372ec00 commit 4cd7c76
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,18 @@ const tests = {
// TODO: this should error but doesn't.
// errors: [genericError('useState')],
},
{
code: normalizeIndent`
// Valid because the hook is outside of the loop
const Component = () => {
const [state, setState] = useState(0);
for (let i = 0; i < 10; i++) {
console.log(i);
}
return <div></div>;
};
`,
},
],
invalid: [
{
Expand Down

0 comments on commit 4cd7c76

Please sign in to comment.