client/src/components/Clock.js
changeset 21 284e866f55c7
child 28 abf9f3ff2635
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/components/Clock.js	Thu Jun 08 11:13:41 2017 +0200
@@ -0,0 +1,25 @@
+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