From 4f285349adec93a040e41d1d8c0c1c7b57749397 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 21 Sep 2023 14:56:35 +0700 Subject: add context for list product popup cart --- src/contexts/ProductCartContext.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/contexts/ProductCartContext.js (limited to 'src/contexts') 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 ( + + {children} + + ) +} + +export const useProductCartContext = () => { + return useContext(ProductCartContext) +} -- cgit v1.2.3