summaryrefslogtreecommitdiff
path: root/src/contexts
diff options
context:
space:
mode:
Diffstat (limited to 'src/contexts')
-rw-r--r--src/contexts/ProductContext.js15
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)
+}