main
| 1 | import { useContext } from "react" |
| 2 | import { ShippingOptionPriceContext } from "./shipping-option-price-context" |
| 3 | |
| 4 | export const useShippingOptionPrice = () => { |
| 5 | const context = useContext(ShippingOptionPriceContext) |
| 6 | |
| 7 | if (!context) { |
| 8 | throw new Error( |
| 9 | "useShippingOptionPrice must be used within a ShippingOptionPriceProvider" |
| 10 | ) |
| 11 | } |
| 12 | |
| 13 | return context |
| 14 | } |