6f66b4a526
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
35 lines
858 B
JavaScript
35 lines
858 B
JavaScript
import React, { useEffect, useState } from "react";
|
|
import logo from "./logo.svg";
|
|
import "./App.css";
|
|
|
|
function App() {
|
|
const [message, setMessage] = useState();
|
|
useEffect(() => {
|
|
fetch("/api/users")
|
|
.then((res) => res.json())
|
|
.then((res) => setMessage(`Hello with ${res.length} users`))
|
|
.catch(console.error);
|
|
}, [setMessage]);
|
|
return (
|
|
<div className="App">
|
|
<header className="App-header">
|
|
<img src={logo} className="App-logo" alt="logo" />
|
|
<p>{message || "Loading..."}</p>
|
|
<p>
|
|
Edit <code>src/App.js</code> and save to reload.
|
|
</p>
|
|
<a
|
|
className="App-link"
|
|
href="https://reactjs.org"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
Learn React
|
|
</a>
|
|
</header>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default App;
|