-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react/no-unused-state triggered when optional chaining is used #2515
Comments
Presumably you're using babel-eslint since optional chaining just got stage 4 within the last 10 hours; it seems reasonable to modify all the rules that check for dotted and bracketed things to also check for optionally dotted and bracketed things. |
edited with babel-eslint version |
Sorry to nitpick, but is this an |
Actually I'm not sure it's either.
|
State is https://codesandbox.io/s/react-state-null-initially-ui5rp: class App extends React.Component {
render() {
return (
<div>{JSON.stringify(this.state)}</div>
);
}
} |
well sure, but you're always supposed to give it an initial value - does |
Yup, it works! React doesn't give any warning or indication, so I'd assume there are many (like me) who relied on the behavior. |
Oof, that sounds awful :-/ hopefully #2588 will resolve this, either way. |
eslint: 6.5.1
eslint-plugin-react: 7.16.0
babel-eslint: 10.0.3
in constructor:
but when
this.state?.downloading
is used i got this message:The text was updated successfully, but these errors were encountered: