Created
May 29, 2021 13:39
-
-
Save iskenxan/d5c0326587cce9637252ca0edf03f058 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 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