Week3 homework#6
Open
lanettecream wants to merge 1 commit into
Open
Conversation
bhague1281
reviewed
May 24, 2018
| }; | ||
| } | ||
|
|
||
| addRoom = (room) => { |
Contributor
There was a problem hiding this comment.
The easiest way to deal with binding functions is to use the arrow function syntax you used here only. By doing so, you shouldn't need to use this.addRoom = this.addRoom.bind(this), although the function will still behave the same because you're binding to the same context.
| removeRoom = (room) => { | ||
| this.setState((prevState) => { | ||
| let rooms = prevState.rooms; | ||
| let filteredRooms = rooms.filter(item => item.title !== room.title); |
Contributor
There was a problem hiding this comment.
Nice 👍 Ideally if the Airbnbs had ids, we could filter on those as well.
|
|
||
| it('renders without crashing with props', () => { | ||
| const div = document.createElement('div'); | ||
| ReactDOM.render(<Cart ={testArticle} type="article" />, div); |
Contributor
There was a problem hiding this comment.
This ={testArticle} is causing a syntax error with your tests. The best way to test this is to create a fake props object above, then pass it into the Cart component. If you need to pass functions, you can use jest.fn() to create a mock function.
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.
My understanding: 3 out of 5. Please explain binding and sending state across components more
Complete: As complete as I can make it before the deadline.