Skip to content

Instantly share code, notes, and snippets.

@eamonnboyle
Last active February 23, 2021 16:48
Show Gist options
  • Save eamonnboyle/9fa31d1ea572dc610a3af1a1154236fe to your computer and use it in GitHub Desktop.
Save eamonnboyle/9fa31d1ea572dc610a3af1a1154236fe to your computer and use it in GitHub Desktop.
Weather App Tutorial - Break out Table Component
import React, {FC} from "react";
interface LocationTableProps {
locations: string[];
}
export const LocationTable: FC<LocationTableProps> = ({locations}) =>
<div>
<h2>Locations</h2>
<table className="table table-hover">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
{locations.map((location, index) =>
<tr key={index}><td>{location}</td></tr>
)}
</tbody>
</table>
</div>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment