Skip to content

Instantly share code, notes, and snippets.

@r1ckhenry
Created January 29, 2020 22:24
Show Gist options
  • Save r1ckhenry/32d9348a9d042c363447535f03944086 to your computer and use it in GitHub Desktop.
Save r1ckhenry/32d9348a9d042c363447535f03944086 to your computer and use it in GitHub Desktop.
import React from "react";
import Fetcher from "./Fetcher";
const Table = props => {
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Poulation</th>
</tr>
</thead>
<tbody>
{props.data.map(country => {
return (
<tr key={country.name}>
<td>{country.name}</td>
<td>{country.population}</td>
</tr>
);
})}
</tbody>
</table>
);
};
const Countries = () => {
return (
<Fetcher url="https://restcountries.eu/rest/v2/all">
<Table />
</Fetcher>
);
};
export default Countries;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment