import { useQuery, useSubscription } from '@apollo/client' import { updateCache } from '../App' import { ALL_BOOKS, BOOK_ADDED, ME } from '../queries' const Recommend = () => { const result = useQuery(ME) const bookResult = useQuery(ALL_BOOKS) useSubscription(BOOK_ADDED, { onData: ({ data }) => { const addedBook = data.data.bookAdded if (addedBook) { const updatedBooks = bookResult.data.allBooks.concat(addedBook) bookResult.allBooks = updatedBooks } } }) if (result.loading || bookResult.loading) { return
Your Favourite Genre: {user.favouriteGenre}
| author | published | |
|---|---|---|
| {a.title} | {a.author.name} | {a.published} |