```typescript components/EventDetails.tsx
"use client";
import { useEventDetails } from "@trigger.dev/react";
export function EventDetails({ eventId }: { eventId: string }) {
const { isLoading, isError, data, error } = useEventDetails(eventId);
if (isLoading) {
return Loading...
;
}
if (isError) {
return Error: {error.message}
;
}
//get the first run (if one has started yet)
const firstRun = event.data?.runs?.at(0);
//if the run is there, show the status, otherwise loading
return {firstRun ? firstRun.status : "Loading"}
;
}
```