Reputation: 10009
This is my eslintrc. It complains about
let state = {dataObjects: insurances }
not being correct.
What should I do to fix this? The code is running without errors otherwise.
.eslintrc
{
"extends": "airbnb",
"env": {
"es6": true
},
"parserOptions": {
"sourceType": "module"
}
}
TextablesScreen
12 class TextablesScreen extends React.PureComponent {
13 /* ***********************************************************
14 * STEP 1
15 * This is an array of objects with the properties you desire
16 * Usually this should come from Redux mapStateToProps
17 ************************************************************ */
>> 18 let state = {
19 dataObjects: insurances
20 }
Upvotes: 0
Views: 651
Reputation: 108510
In React, this.state
should be treated as if it were immutable. Using let
for states makes no sense, instead you should add it as a class property:
class TextablesScreen extends React.PureComponent {
state = {
dataObjects: insurances
}
/* ... */
Or set state in constructor if you need props
to populate default state:
constructor(props) {
super(props)
this.state = ...
}
Upvotes: 3