Last active
February 23, 2021 16:48
-
-
Save eamonnboyle/9fa31d1ea572dc610a3af1a1154236fe to your computer and use it in GitHub Desktop.
Weather App Tutorial - Break out Table Component
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, {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