Bachelorthesis_Code/frontend/src/App.js

26 lines
615 B
JavaScript
Raw Normal View History

import React, { useState, useEffect } from 'react';
import logo from './logo.svg';
2021-05-05 01:08:58 +00:00
import './App.css';
function App() {
const [currentTime, setCurrentTime] = useState(0);
useEffect(() => {
fetch('/time').then(res => res.json()).then(data => {
setCurrentTime(data.time);
});
}, []);
return (
<div className="App">
<header className="App-header">
<p>The current time is {currentTime}.</p>
</header>
</div>
);
2021-05-05 01:08:58 +00:00
}
export default App;