Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created April 20, 2019 21:50
Show Gist options
  • Save treyhuffine/fbb1af9596ecd89a3043772af07ecfaf to your computer and use it in GitHub Desktop.
Save treyhuffine/fbb1af9596ecd89a3043772af07ecfaf to your computer and use it in GitHub Desktop.
import * as React from 'react';
import { LaunchListQuery } from '../../generated/graphql';
import './styles.css';
interface Props {
data: LaunchListQuery;
}
const className = 'LaunchList';
const LaunchList: React.FC<Props> = ({ data }) => (
<div className={className}>
<h3>Launches</h3>
<ol className={`${className}__list`}>
{!!data.launches &&
data.launches.map(
(launch, i) =>
!!launch && (
<li key={i} className={`${className}__item`}>
{launch.mission_name} ({launch.launch_year})
</li>
),
)}
</ol>
</div>
);
export default LaunchList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment