2021-05-07 02:00:13 +00:00
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
import logo from './logo.svg';
|
2021-05-05 01:08:58 +00:00
|
|
|
import './App.css';
|
|
|
|
|
|
|
|
function App() {
|
2021-05-07 02:00:13 +00:00
|
|
|
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;
|