client/src/components/Clock.js
author Alexandre Segura <mex.zktk@gmail.com>
Thu, 08 Jun 2017 11:13:41 +0200
changeset 21 284e866f55c7
child 28 abf9f3ff2635
permissions -rw-r--r--
First version of categories tooltip. - Use react-portal to display hovering menu. - Add custom Mark to store category data.

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