In a new create-react-app, hot reloading seems to be taking effect only for css files. In the simple example below, clicking on the first hello increments the timer to 1. Then, when I change e.g. the second "Hello" text to "Goodbye", the page reloads and the timer is set to 0 again.
Am I misunderstanding hot-reloading perhaps? I thought that it's purpose is to stop the re-render from happening.
import React from 'react';
import './App.css'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
timer: 0,
};
this.timerInc = this.timerInc.bind(this);
}
timerInc() {
this.setState({
timer: 1,
})
}
render () {
return (
<div className="App">
<h1 onClick={this.timerInc}>Hello</h1>
<h1>{this.state.timer}</h1>
<h1>Hello</h1>
</div>
)};
}
export default App;