Skip to content

Commit e5d5273

Browse files
committed
Step 16
1 parent 29c148e commit e5d5273

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pages/country/[name].js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ export async function getStaticPaths() {
1818

1919
export async function getStaticProps(context) {
2020
const { name } = context.params;
21-
return { props: { name } };
21+
const response = await fetch(DATA);
22+
const data = await response.json();
23+
const rows = data[name];
24+
return { props: { name, rows } };
2225
}
2326

24-
export default function Country({ name }) {
27+
export default function Country({ name, rows }) {
2528
return (
2629
<>
2730
<h1 style={{ textAlign: "center" }}>{name}</h1>

0 commit comments

Comments
 (0)