library/pages/index.tsx

21 lines
357 B
TypeScript

import React from "react";
import { getAllBooks, SimpleBook } from "../lib/books";
export default function Home(props: Props) {
console.log(props.books);
return <main>I am a book</main>;
}
interface Props {
books: SimpleBook[];
}
export async function getServerSideProps() {
return {
props: {
books: await getAllBooks(),
},
};
}