use-shopping-cart logouse-shopping-cart
Configuration

shouldPersist

This prop is used to determine if the cart should be persisted to local storage. If you don't want to persist the cart to local storage, you can set this prop to false. The default value is true.

import ReactDOM from 'react-dom'
import { CartProvider } from 'use-shopping-cart/react'

import App from './App'

ReactDOM.render(
  <CartProvider
    stripe={process.env.REACT_APP_STRIPE_API_PUBLIC}
    currency="USD"
    shouldPersist={false}
  >
    <App />
  </CartProvider>,
  document.getElementById('root')
)

Shopping Cart

Your cart is empty

Try the interactive demos on the docs pages!