diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 02:05:29 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-09-22 02:05:29 +0000 |
| commit | 23b667695991fafeae523aff1de7df81770461cd (patch) | |
| tree | 6ce4958f4000e3db72ceddebe7ffb468eefe395b /src/contexts/ProductContext.js | |
| parent | 6ac18fd7baaf617f12f8fd6edde8a4881c547330 (diff) | |
| parent | bda91439b6ef4605a579bde8bef603b551aab3dd (diff) | |
Merged in Feature/popup_cart (pull request #72)
Feature/popup cart
Diffstat (limited to 'src/contexts/ProductContext.js')
| -rw-r--r-- | src/contexts/ProductContext.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/contexts/ProductContext.js b/src/contexts/ProductContext.js new file mode 100644 index 00000000..7bf65989 --- /dev/null +++ b/src/contexts/ProductContext.js @@ -0,0 +1,15 @@ +import { createContext, useContext, useState } from 'react' + +const ProductContext = createContext() + +export const ProductProvider = ({ children }) => { + const [product, setProduct] = useState(null) + + return ( + <ProductContext.Provider value={{ product, setProduct }}>{children}</ProductContext.Provider> + ) +} + +export const useProductContext = () => { + return useContext(ProductContext) +} |
