client/src/components/Clock.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 08 Jun 2017 18:54:36 +0200
changeset 25 e04714a1d4eb
parent 21 284e866f55c7
child 28 abf9f3ff2635
permissions -rw-r--r--
Improve categories tooltip. - Manage categories with comment enabled. - Rename mark type to "category". - Simplify code, use only one mark type.

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