-
Notifications
You must be signed in to change notification settings - Fork 2
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
useLocalStorage + useReducer + useContext #81
Conversation
Co-authored-by: Lee Sager <[email protected]> Co-authored-by: Eric Barch <[email protected]>
Co-authored-by: Larkin <[email protected]>
Co-authored-by: Larkin <[email protected]>
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.
Great work with this refactor and the detailed documentation!
Just a few items to be addressed, and a few items for clean up.
@larkinds hi! I fixed all the requested changes and wanted to ask if you have any other comments. Otherwise, we might need this to be approved and merged for the next issues. |
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.
Looks good! Great work :)
In this PR I refactored and merged all the code we had on these three topics. The working version can be applied to Cart, Checkout, Single Product page and Hall of Fame. The resulting local storage hooks are used in 2 contexts: user and cart, but they are reusable could be potentially applied to the new contexts.
For Functionality: Create a localStorage Hook that Removes an Item or Clears localStorage Entirely #44, this solution can remove items from cart through reducer.
For Feature: Update/Persist State When Data Changes - Cart and Checkout #54, this solution works for all of the cart action types: incrementing, decrementing, adding, removing items.
For Feature: Update State When Data Changes - Hall of Fame, Single Product Pages #53, this solution works for all of the action types on the single product page: increasing and decreasing ice cream quantity, toppings. On Hall of Fame page, local storage seems to persist items.