Skip to content
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

SockInventory: Fix bug that inventory update is not immediately visible #6

Open
3 tasks
Laoujin opened this issue May 13, 2019 · 0 comments
Open
3 tasks
Labels
good first issue Good for newcomers hooks Using the new Hooks feature

Comments

@Laoujin
Copy link
Member

Laoujin commented May 13, 2019

File: SockInventory.tsx

When clicking the "Add to cart" button on a Sock detail page, nothing seems to be happening. We need to go back to the prev screen and return before a rerender happens.

This is because the sock prop is mutated.

<button onClick={() => sock.inventory--}>
       Add to cart
</button>

Fix the bug by using state properly.

Create a PR per task

  • Implement either with
    • A component class and state
    • Hooks
  • Add a button to remove from the Cart
@Laoujin Laoujin added good first issue Good for newcomers hooks Using the new Hooks feature labels May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hooks Using the new Hooks feature
Projects
None yet
Development

No branches or pull requests

1 participant