1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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)
const [productQuotation, setProductQuotation] = useState(null)
return (
<ProductCartContext.Provider
value={{ productCart, setProductCart, refreshCart, setRefreshCart, isLoading, setIsloading, productQuotation, setProductQuotation}}
>
{children}
</ProductCartContext.Provider>
)
}
export const useProductCartContext = () => {
return useContext(ProductCartContext)
}
|