ProductQuantityAdjustButton Component
The ProductQuantityAdjustButton component renders a button that adjusts the quantity of a product when pressed. It must be a descendant of both the CartProvider and ProductProvider components.
Usage
import React from "react";
import { ProductQuantityAdjustButton } from "@airsoko/react";
const MyComponent = () => {
return <ProductQuantityAdjustButton adjust="increase">Increase Quantity</ProductQuantityAdjustButton>;
};
export default MyComponent;Props
| Name | Type | Default | Description |
|---|---|---|---|
adjust | 'increase' | 'decrease' | 'remove' | 'increase' | The adjustment for a cart line's quantity. Valid values are 'increase' (default), 'decrease', or 'remove'. |
otherProps | Object | Any other props accepted by the underlying button component. |
Notes
- Ensure that the
ProductQuantityAdjustButtoncomponent is a descendant of both theCartProviderandProductProvidercomponents to access necessary cart and product data. - The
ProductQuantityAdjustButtoncomponent internally utilizes theuseCartanduseProducthooks to access cart and product-related functions and data. - The
adjustprop determines the type of quantity adjustment to perform when the button is clicked.