Alexandra Koren - week 3 submission#5
Open
sashako8 wants to merge 4 commits intofrontend-application-development-uw20:masterfrom
Open
Alexandra Koren - week 3 submission#5sashako8 wants to merge 4 commits intofrontend-application-development-uw20:masterfrom
sashako8 wants to merge 4 commits intofrontend-application-development-uw20:masterfrom
Conversation
bhague1281
reviewed
May 31, 2020
| } | ||
| } | ||
|
|
||
| addItemToCart = (idx) => { |
|
|
||
| removeItem = (idx) => { | ||
| return (e) => { | ||
| const totalCost = this.state.total - Airbnbs[idx].payment.cost; |
Contributor
There was a problem hiding this comment.
Accessing Airbnbs[idx] causes the app to crash if more than 3 Airbnbs are added to the cart + the last Airbnb is removed. It can also result in incorrect payment costs to be subtracted. To fix this, you'll want to access this.state.cartItems[idx] instead, since the index refers to the cart array, not the airbnb array.
| {airbnb.host.isSuperhost ? <p class="host">Is a Superhost: Yes</p> : null} | ||
| <p>Stars: {airbnb.rating.stars}</p> | ||
| <p>Reviews: {airbnb.rating.reviews}</p> | ||
| </div> |
Contributor
There was a problem hiding this comment.
This looks great, all the data's there
| isSuperhost: PropTypes.bool.isRequired, | ||
| stars: PropTypes.string.isRequired, | ||
| reviews: PropTypes.string.isRequired | ||
| }) |
Contributor
There was a problem hiding this comment.
These proptypes accurately describe the shape of an airbnb, but a few things:
- Since
airbnbsis an array, you'll want to useProptypes.arrayOf(PropTypes.shape(...))to describe an array of objects. airbnbsisn't used as a prop in this component, so this could be moved to theListingLayoutcomponent instead.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Week 3 HW Submission
Please fill out the information below in order to complete your assignment. Feel free to update this comment later if necessary.