import { useEffect, useState } from 'react' import heroImg from './assets/hero.png' import reactLogo from './assets/react.svg' import viteLogo from './assets/vite.svg' import './App.css' function App() { const [count, setCount] = useState(0) const [me, setMe] = useState<{ email: string | null } | 'error'>() useEffect(() => { fetch('/api/me') .then((res) => (res.ok ? res.json() : Promise.reject(res.status))) .then(setMe, () => setMe('error')) }, []) return (
React logo Vite logo

React + Vite on exe.dev

Edit src/App.tsx and save: the page updates and keeps the count.

{me === undefined && 'Asking the API…'} {me === 'error' && 'The API is not answering.'} {me && me !== 'error' && (me.email ? `The API says you're ${me.email}.` : "The API answered; you're not signed in to exe.dev.")}

) } export default App