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
no-access-state-in-setstate bug? #1597
Labels
Comments
ljharb
added a commit
that referenced
this issue
Dec 13, 2017
Find edge case in no-access-state-in-setstate (#1597)
This was referenced Jan 26, 2018
This was referenced Sep 22, 2018
Open
This was referenced Sep 23, 2018
This was referenced Oct 25, 2018
This was referenced Nov 7, 2018
This was referenced Nov 23, 2018
1 task
1 task
This was referenced Dec 21, 2018
This was referenced Jan 2, 2019
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: