I'm getting an eslint
error on this ES6 declaration of a class variable. Can someone suggest either a better syntax, or what eslint rule I need to add or change.
error: ESLint: Parsing error: Unexpected token =
export default class ErrorBoundary extends React.Component {
state = { hasError: false, error: null };
updateHasErrorsToFalse = () => {
this.setState((prevState) => ({
hasError: false,
}));
}; ...
Here is my .eslintrc.json
{
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["react-hooks"],
"rules": {
"semi": [2, "always"],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error"
}
}