Skip to content

Instantly share code, notes, and snippets.

@eveporcello
Created August 7, 2023 17:57
Show Gist options
  • Save eveporcello/fa683859b9dc1934a0543677dbceac10 to your computer and use it in GitHub Desktop.
Save eveporcello/fa683859b9dc1934a0543677dbceac10 to your computer and use it in GitHub Desktop.
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