useCartLine
The useCartLine hook provides access to the CartLine object from the Storefront API. It must be a descendant of a CartProvider component.
Prerequisites
The useCartLine hook must be a descendant of a CartProvider component.
import { CartProvider } from "@airsoko/react";
export function App() {
<CartProvider>
<Component />
</CartProvider>;
}Example Usage
import React from "react";
import { useCartLine } from "@airsoko/react"; // Import the useCartLine hook
const CartLineComponent = () => {
// Use the useCartLine hook to access cart line functionality
const cartLine = useCartLine();
console.log(cartLine);
return <div>{/* Render cart line properties here */}</div>;
};
export default CartLineComponent;Props
- None
Returns
CartLinePartialDeep: A partial deep object representing a cart line.
CartLinePartialDeep
| Property | Type | Description |
|---|---|---|
| // insert properties here | ||
| // describe each property here |