Add fullstack example

This commit is contained in:
Mike Conrad
2025-06-11 15:23:27 -04:00
parent 0313358d16
commit f98e05b677
28 changed files with 3181 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import { useState, useEffect } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
function App() {
const [count, setCount] = useState(0)
const [greeting, setGreeting] = useState()
useEffect(() => {
fetch('/api')
.then(res => res.json())
.then(data => setGreeting(data))
}, [])
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<h2>{ JSON.stringify(greeting) ?? 'adf' }</h2>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
}
export default App