-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
no-access-state-in-setstate bug? #1597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
This was referenced Jan 26, 2018
This was referenced Sep 22, 2018
This was referenced Jan 8, 2019
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
The react/no-access-state-in-setstate rule should prevent usage of
this.state
insidesetState
calls. I can see the it generating error with the following code:Example with errors / trigger
but when the
state
variable is destructured fromthis.state
, there will be no errors/warnings:Example without errors / trigger
This is especially troublesome when using react/destructuring-assignment with the
react/no-access-state-in-setstate
.System & setup
Windows 10, node v.8.9.3, eslint-plugin-react v. 7.5.1, ESLint v.3.19.0 & babel-eslint 8.0.3, using the rule
'react/no-access-state-in-setstate': 2
.The text was updated successfully, but these errors were encountered: