library/pages/index.tsx

20 lines
323 B
TypeScript

import React from "react";
import { getBook, DetailedBook } from "../lib/books";
export default function Home(props: Props) {
return <p>{props.book.title}</p>;
}
interface Props {
book: DetailedBook;
}
export async function getServerSideProps() {
return {
props: {
book: await getBook(2),
},
};
}