My handleClick arrow function got unexpected error I have no clue why, couldn't spot any error.
class HelloWidget extends React.Component {
constructor(props) {
super(props);
this.names_holder = [];
this.state = {
name: []
};
}
handleClick = () => { //error here
let random = this.names_holder.concat(Math.ceil(Math.random() * 10) + 3);
this.setState({
name: random
});
}
render() {
return <div className = "widget" >
< button onClick = {
this.handleClick
} > Random concat < /button> {
JSON.stringify(this.state.name)
} < /div>;
}
}