Skip to content

Instantly share code, notes, and snippets.

@Harshmakadia
Created February 24, 2019 11:15
Show Gist options
  • Save Harshmakadia/e57105dae57f9677263e0e81b03fb9ed to your computer and use it in GitHub Desktop.
Save Harshmakadia/e57105dae57f9677263e0e81b03fb9ed to your computer and use it in GitHub Desktop.
Add Update Method
// Method to addProductToCart
<div>
<button
onClick={context.addProductToCart.bind(this, product)}
>
Add to Cart
</button>
</div>
// Method to removeProductFromCart
<div>
<button
onClick={this.context.removeProductFromCart.bind(this,cartItem.id)}
>
Remove from Cart
</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment