Skip to content

Instantly share code, notes, and snippets.

@iskenxan
Created May 29, 2021 13:39
Show Gist options
  • Save iskenxan/d5c0326587cce9637252ca0edf03f058 to your computer and use it in GitHub Desktop.
Save iskenxan/d5c0326587cce9637252ca0edf03f058 to your computer and use it in GitHub Desktop.
import React, { Suspense } from "react";
import { GET_LAUNCHES } from "./queries";
import { useAPI } from "./useAPI";
const Launches = ({ launches }) => {
return (
<div>
{launches.read().launchesPast.map((item) => (
<div>
<h1>{item.mission_name}</h1>
<p>{item.rocket.rocket_name}</p>
</div>
))}
</div>
);
};
export default function App() {
const { data } = useAPI(GET_LAUNCHES);
return (
<div className="App">
<Suspense fallback={<div>Loading...</div>}>
<Launches launches={data} />
</Suspense>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment