cami
18e6420500
- App zeigt nun eine Zeit an, wenn backend zur verfügung steht - Docker-Port ist auf 3000, weil Standard
25 lines
615 B
JavaScript
25 lines
615 B
JavaScript
import React, { useState, useEffect } from 'react';
|
|
import logo from './logo.svg';
|
|
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>
|
|
);
|
|
}
|
|
|
|
export default App;
|