As their methods are invoked in the components React?

I have the following code, there is a component in which two methods componentDidMount, componentWillUnmount, one cyclically updates the status, the other ceases to update how they work, if not explicitly called. Code - creates a time, and continuously updates the status time.
class Clock extends React.Component {
 constructor(props) {
 this.state = {date: new Date()};

 componentDidMount() {
 this.timerID = setInterval(
 () => this.tick(),

 componentWillUnmount() {

 tick() {
 date: new Date()

 render() {
 return (
the <div>
 <h1>Hello, world!</h1>
 <h2>It is {}.</h2>

June 27th 19 at 15:14
1 answer
June 27th 19 at 15:16
tick is called every second, and in his body there is a setState, which after work, automatically calls the render () method. So every second is rerender your component

Find more questions by tags JavaScriptReact