MCPcopy Create free account
hub / github.com/wesbos/Advanced-React / AddToCart

Function AddToCart

finished-application/frontend/components/AddToCart.js:13–23  ·  view source on GitHub ↗
({ id })

Source from the content-addressed store, hash-verified

11`;
12
13export default function AddToCart({ id }) {
14 const [addToCart, { loading }] = useMutation(ADD_TO_CART_MUTATION, {
15 variables: { id },
16 refetchQueries: [{ query: CURRENT_USER_QUERY }],
17 });
18 return (
19 <button disabled={loading} type="button" onClick={addToCart}>
20 Add{loading && 'ing'} To Cart 🛒
21 </button>
22 );
23}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected