11 lines
263 B
JavaScript
11 lines
263 B
JavaScript
import { useContext } from "react";
|
|
import { ShopContext } from "./ShopContextBase";
|
|
|
|
export const useShop = () => {
|
|
const value = useContext(ShopContext);
|
|
if (!value) {
|
|
throw new Error("useShop must be used inside ShopProvider.");
|
|
}
|
|
return value;
|
|
};
|