import React from 'react' class Clock extends React.Component { constructor(props) { super(props) this.state = { time: new Date() } } componentDidMount() { console.log('mount') this.intervalId = setInterval(this.tick.bind(this), 1000); } componentWillUnmount() { console.log('unmount') clearInterval(this.intervalId); } render() { return (