Updated some things in the frontend
- App zeigt nun eine Zeit an, wenn backend zur verfügung steht - Docker-Port ist auf 3000, weil Standard
This commit is contained in:
parent
8fd0e44422
commit
18e6420500
2 changed files with 20 additions and 8 deletions
|
@ -10,6 +10,6 @@ services:
|
||||||
- '.:/app:z'
|
- '.:/app:z'
|
||||||
- '/app/node_modules'
|
- '/app/node_modules'
|
||||||
ports:
|
ports:
|
||||||
- 3001:3000
|
- 3000:3000
|
||||||
environment:
|
environment:
|
||||||
- CHOKIDAR_USEPOLLING=true
|
- CHOKIDAR_USEPOLLING=true
|
||||||
|
|
|
@ -1,13 +1,25 @@
|
||||||
import React from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import HelloWorld from './HelloWorld';
|
import logo from './logo.svg';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
const [currentTime, setCurrentTime] = useState(0);
|
||||||
<div classname="App">
|
|
||||||
<HelloWorld />
|
useEffect(() => {
|
||||||
</div>
|
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;
|
export default App;
|
||||||
|
|
Loading…
Reference in a new issue