Excuse the silly title :)
I have a button which when clicked runs a function called restart which simply resets a state. I want to make this button easily accessible, so when you press the tab, the button highlights prompting you to either press enter or click it.
basic code
class Home extends Component{
restart(){
this.setState({popup:false,finished:true,started:false,userInput:""})
}
render(){
return(
<div>
<button className="btn btn-dark buttons" onClick={this.restart.bind(this)}>Restart</button>
</div>
)
}
Everything works fine if you click the button, but when pressing Enter, the page is reloaded which is quite harmful.
How might I be able to disable this reload when the button is submitted using the Enter key, and still call the restart method.