Skip to content

Instantly share code, notes, and snippets.

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