Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created January 16, 2021 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techomoro/dcbfcada7bf732a6ec66f1396294d266 to your computer and use it in GitHub Desktop.
Save techomoro/dcbfcada7bf732a6ec66f1396294d266 to your computer and use it in GitHub Desktop.
import React, { useContext } from "react";
import AppContext from "../AppContext";
function Favorites() {
const value = useContext(AppContext);
return (
<div className="books">
{value.state.favorites.map((book, index) => {
return (
<div className="book" key={index}>
<h2 className="title">{book.title}</h2>
<p className="description">{book.description}</p>
<h6 className="author">{book.author}</h6>
</div>
);
})}
</div>
);
}
export default Favorites;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment