import React from "react";
import { getAllBooks, SimpleBook } from "../lib/books";
export default function Home(props: Props) {
return (
{props.books.map((book, idx) => {
return (
-
{book.title}; {book.authors}; {book.isbn}
);
})}
);
}
interface Props {
books: SimpleBook[];
}
export async function getServerSideProps() {
return {
props: {
books: await getAllBooks(),
},
};
}