LinkList/frontend/pages/index.tsx

23 lines
548 B
TypeScript
Raw Normal View History

2021-03-03 18:51:53 -05:00
import React from "react";
import { GetStaticProps } from "next";
2021-03-22 15:35:13 -04:00
import { Links } from "components";
// TODO: change
const API = "https://api.thedogapi.com/v1/breeds?limit=10&page=0";
2021-03-03 16:38:09 -05:00
2021-03-03 18:51:53 -05:00
export const getStaticProps: GetStaticProps = async () => {
2021-03-22 15:35:13 -04:00
// fetch data here
const data = await fetch(API).then((res) => res.json());
2021-03-03 18:51:53 -05:00
return {
2021-03-22 15:35:13 -04:00
props: { links: data }, // will be passed to the page component as props
2021-03-03 18:51:53 -05:00
revalidate: 1,
};
};
const Home: React.FC = ({ links }: any) => {
2021-03-22 15:35:13 -04:00
return <Links links={links} />;
2021-03-03 18:51:53 -05:00
};
export default Home;