Skip to content

Commit e8292fd

Browse files
committed
Add test for setState callback with no arguments.
1 parent 24374b0 commit e8292fd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/lib/rules/no-unused-state.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,18 @@ eslintTester.run('no-unused-state', rule, {
704704
}
705705
`,
706706
parser: 'babel-eslint'
707+
}, {
708+
// Don't error out
709+
code: `
710+
class Foo extends Component {
711+
handleChange = function() {
712+
this.setState(() => ({ foo: value }));
713+
}
714+
render() {
715+
return <SomeComponent foo={this.state.foo} />;
716+
}
717+
}`,
718+
parser: 'babel-eslint'
707719
}, {
708720
// Don't error out
709721
code: `

0 commit comments

Comments
 (0)