-
Notifications
You must be signed in to change notification settings - Fork 48
Sockets - Shubha #23
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
base: master
Are you sure you want to change the base?
Sockets - Shubha #23
Conversation
TREKWhat We're Looking For
|
| const setReservationButtonHandler = (tripID, continent) => { | ||
| $('#reserve-button').off(); | ||
| $('#reserve-button').click((event) => { | ||
| event.preventDefault(); |
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.
Instead of a click on the button, you should listen for a submit event on the form itself. This will fire both when the button is clicked and when the user presses <enter>.
Also, good catch turning off any previous event handler - this avoids a tricky bug with sending multiple POST requests.
| const buildTripClickHandler = (trip) => { | ||
|
|
||
| const handler = () => { | ||
| changeSelected(trip.id); |
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.
Good use of a closure to keep track of the trip data.
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
thenandcatchmethod were chained on to the request.Tripin the list by its ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.