Can someone help me why I get the error of ==> Unexpected token, expected ";"
const AppRoot = () => {
const [tabIndex, setTabIndex] = React.useState(1);
const handleTabsChange = index => {
setTabIndex(index);
};
this.state={
backgroundColor: 'black',
backgroundColor2: 'black',
pressed: false,
};
changeColor(){
if(!this.state.pressed){
this.setState({ pressed: true,backgroundColor: 'red', backgroundColor2: 'black'});
} else {
this.setState({ pressed: false, backgroundColor: 'black' ,backgroundColor2: 'red'});
}
}