This commit is contained in:
QkoSad
2023-08-08 16:02:54 +03:00
commit 0a7a469d56
315 changed files with 426907 additions and 0 deletions
@@ -0,0 +1,32 @@
import { useQuery } from "@apollo/client";
import { BOOKS_BY_GENRE } from "../queries";
const Recommended = ({ user }) => {
const booksRes = useQuery(BOOKS_BY_GENRE, {
variables: { genre: user.me.favoriteGenre },
});
if (booksRes.loading) return <>loading ....</>
return (
<>
<h2>recommendations</h2>
<div>books in your favotite genre</div>
<table>
<tbody>
<tr>
<th></th>
<th>author</th>
<th>published</th>
</tr>
{booksRes.data.books.map((a, index) => (
<tr key={index}>
<td>{a.title}</td>
<td>{a.author.name}</td>
<td>{a.published}</td>
</tr>
))}
</tbody>
</table>
</>
);
};
export default Recommended;