-
-
Save eveporcello/fa683859b9dc1934a0543677dbceac10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "./App.css"; | |
import { useQuery, gql } from "@apollo/client"; | |
const QUERY = gql` | |
query { | |
allLifts { | |
id | |
name | |
status | |
} | |
} | |
`; | |
export function App() { | |
const { loading, data } = useQuery(QUERY); | |
if (loading) return <p>loading lifts...</p>; | |
return ( | |
<section> | |
<h1>Snowtooth Lift Status</h1> | |
{data && !loading && ( | |
<table> | |
<thead> | |
<tr> | |
<th>Lift Name</th> | |
<th>Lift Status</th> | |
</tr> | |
</thead> | |
<tbody> | |
{data.allLifts.map((lift) => ( | |
<tr key={lift.id}> | |
<td>{lift.name}</td> | |
<td>{lift.status}</td> | |
</tr> | |
))} | |
</tbody> | |
</table> | |
)} | |
</section> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment