I am new to react.
I have a class-based component. Let's say the code inside is:
state = {message: "Hello"}
render(){
<div>
<p>this.state.message</p>
<button onclick={() =>this.setState({message: "World"})}>click here</button>
</div>
}
When I click the button, display on the screen change from "Hello" to "World", but then the page refresh and the display turns back to the default "Hello" again.
How should I prevent the automatic refresh? I want my page to display "World" after I press the button.
I really appreciate your help.