I'm working through the Tania Rascia React tutorial in an attempt to learn. I ran into a point where I have several errors showing up. The solution to them seems obvious, but I'm just confused if there is something I am missing, since this is the exact way the tutorials code is. This tutorial is officially endorsed by react, which is why I'm baffled. Am I doing something wrong? Or is the tutorial wrong?
Here are the errors:
Line 7: 'state' is not defined no-undef Line 27: 'removeCharacter' is not defined no-undef Line 39: 'characters' is not defined no-undef
and here is the code:
// eslint-disable-next-line
import React, { Component } from 'react';
import Table from './Table.js';
class App extends Component {
render(){
state = {
characters:[
{
'name': 'Charlie',
'job': 'Janitor'
},
{
'name': 'Mac',
'job': 'Bouncer'
},
{
'name': 'Dee',
'job': 'Aspiring Actress'
},
{
'name': 'Dennis',
'job': 'Bartender'
}
]
};
removeCharacter = index => {
const { characters } = this.state;
this.setState({
characters: characters.filter((character, i) => {
return i !== index;
})
});
}
return (
<div className="container">
<Table characterData={characters} />
</div>
);
}
}
export default App;