diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 03:25:33 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 03:25:33 +0000 |
| commit | 8b12b43c0c3f9dd2d2743c83c23ed2a3f30fdae0 (patch) | |
| tree | 6ce4958f4000e3db72ceddebe7ffb468eefe395b /src/contexts | |
| parent | 74b4e3a9b86f1d3b102ad3f907237f7da1b05009 (diff) | |
| parent | bda91439b6ef4605a579bde8bef603b551aab3dd (diff) | |
Merged in Feature/popup_cart (pull request #73)
Feature/popup cart
Diffstat (limited to 'src/contexts')
| -rw-r--r-- | src/contexts/ProductCartContext.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/contexts/ProductCartContext.js b/src/contexts/ProductCartContext.js new file mode 100644 index 00000000..06e97563 --- /dev/null +++ b/src/contexts/ProductCartContext.js @@ -0,0 +1,21 @@ +import { createContext, useCallback, useContext, useEffect, useState } from 'react' + +const ProductCartContext = createContext() + +export const ProductCartProvider = ({ children }) => { + const [productCart, setProductCart] = useState(null) + const [refreshCart, setRefreshCart] = useState(false) + const [isLoading, setIsloading] = useState(false) + + return ( + <ProductCartContext.Provider + value={{ productCart, setProductCart, refreshCart, setRefreshCart, isLoading, setIsloading }} + > + {children} + </ProductCartContext.Provider> + ) +} + +export const useProductCartContext = () => { + return useContext(ProductCartContext) +} |
