LinkList/frontend/pages/index.tsx

23 lines
548 B
TypeScript

import React from "react";
import { GetStaticProps } from "next";
import { Links } from "components";
// TODO: change
const API = "https://api.thedogapi.com/v1/breeds?limit=10&page=0";
export const getStaticProps: GetStaticProps = async () => {
// fetch data here
const data = await fetch(API).then((res) => res.json());
return {
props: { links: data }, // will be passed to the page component as props
revalidate: 1,
};
};
const Home: React.FC = ({ links }: any) => {
return <Links links={links} />;
};
export default Home;