Answer the question
In order to leave comments, you need to log in
How to implement the "Save" component?
Hello! on air bnb, on the product cards there is a component "Save to favorites (liked)"
How to implement it? as I understand it, we have the main state where the state of the entire application is stored + an array with products (product cards) ... when I click on like, do I change false to true on the product card itself or just the like component? is the like button a separate component?
Answer the question
In order to leave comments, you need to log in
the option "when I click on like, I change false to true of the product card itself" - OK (meaning, you change one of the properties in the object with data about this ad, for example: isFavourite: true)
In a real application, the request flies to the server, which the client such-and-such noted such-and-such an object in favorites.
Separate. Or not separate - as you wish. I prefer maximum decomposition.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question