Skip to content

Commit

Permalink
added persistKey page
Browse files Browse the repository at this point in the history
  • Loading branch information
dayhaysoos committed Mar 23, 2023
1 parent f0db2f5 commit f373c09
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/docs/usage/configuration/persistKey.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: persistKey
id: persistKey
---

This property allows you to override the default key used to persist the cart in `localStorage`. By default, the cart is stored under the key `root`.

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

import App from './App'

ReactDOM.render(
<CartProvider
mode="payment"
cartMode="checkout-session"
stripe={process.env.REACT_APP_STRIPE_API_PUBLIC}
billingAddressCollection={false}
successUrl="https://stripe.com"
cancelUrl="https://twitter.com/dayhaysoos"
currency="USD"
shouldPersist={false}
persistKey="my-redux-persist-key"
>
<App />
</CartProvider>,
document.getElementById('root')
)
```

0 comments on commit f373c09

Please sign in to comment.