Created
September 30, 2021 15:59
-
-
Save hackintoshrao/5d7e397ac0ceed16e4408adc79150fab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Books({ onBookSelected }) { | |
const { loading, error, data } = useQuery(GET_BOOKS); | |
if (loading) return 'Loading...'; | |
if (error) return `Error! ${error.message}`; | |
return ( | |
<select name="book" onChange={onBookSelected}> | |
{data.books.map(book => ( | |
<option key={book.id} value={book.title}> | |
{book.title} | |
</option> | |
))} | |
</select> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment