| author | ymh <ymh.work@gmail.com> |
| Thu, 08 Jun 2017 17:57:57 +0200 | |
| changeset 24 | 3b3999550508 |
| parent 21 | 284e866f55c7 |
| child 28 | abf9f3ff2635 |
| permissions | -rw-r--r-- |
import React, { Component } from 'react'; import { Label } from 'react-bootstrap'; import moment from 'moment'; class Clock extends Component { state = { time: moment().format('H:mm:ss'), } componentDidMount() { setInterval(() => { const time = moment().format('H:mm:ss'); this.setState({ time }); }, 1000); } render() { return ( <Label bsStyle="info">{ this.state.time }</Label> ); } } export default Clock