import React, { useEffect, useState } from "react"; import logo from "./logo.svg"; import "./App.css"; type Greeting = { id: number; name: string; }; function App() { const [greeting, setGreeting] = useState(); useEffect(() => { fetch("/api") .then(res => res.json()) .then(setGreeting) .catch(console.error); }, [setGreeting]); return (
logo {greeting ? (

Hello from {greeting.name}

) : (

Loading...

)}

Edit src/App.tsx and save to reload.

Learn React
); } export default App;