-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homew5 context bogdan mireanu #61
base: bogdan-mireanu
Are you sure you want to change the base?
Conversation
…sa mearga pentru fiecare itemid si nu pentru toate la click
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, e bine pentru inceput
} | ||
|
||
addToWishlist = (bookId) => { | ||
const bookWishlist = this.state.bookList.find(item => item.id === bookId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pai fiecare carte ar trebui sa contina o proprietate numita cum vrei tu, poate wishListed
, de tip boolean, iar cand dai click pe butonul unei carti, schimbi doar valoarea acelei proprietati. Ceva de genul:
const newBooks = this.state.bookList.map(book => {
if(book.id === bookId) {
book.wishListed = !book.wishListed;
}
return book;
});
this.setState({bookList: newBooks});
</div>); | ||
if (this.state.loader1 && !this.state.loader2) | ||
return ( | ||
<WishlistContext.Provider value={{wishlist:this.state.wishlist}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nu prea vad nevoia acestui context
<WishlistContext.Provider value={{wishlist:this.state.wishlist}}> | |
<WishlistContext.Provider value={{wishlist:this.state.wishlist}}> |
mi-am prins urechile in functia addToWishlist, nu am reusit sa o fac sa mearga pentru fiecare itemid si nu pentru toate la click