MCPcopy
hub / github.com/reduxjs/redux / addToCart

Function addToCart

examples/shopping-cart/src/actions/index.js:20–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18})
19
20export const addToCart = productId => (dispatch, getState) => {
21 if (getState().products.byId[productId].inventory > 0) {
22 dispatch(addToCartUnsafe(productId))
23 }
24}
25
26export const checkout = products => (dispatch, getState) => {
27 const { cart } = getState()

Callers

nothing calls this directly

Calls 3

getStateFunction · 0.85
addToCartUnsafeFunction · 0.85
dispatchFunction · 0.50

Tested by

no test coverage detected