Packages
react
components
ProductQuantityAdjustButton

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

NameTypeDefaultDescription
adjust'increase' | 'decrease' | 'remove''increase'The adjustment for a cart line's quantity. Valid values are 'increase' (default), 'decrease', or 'remove'.
otherPropsObjectAny other props accepted by the underlying button component.

Notes

  • Ensure that the ProductQuantityAdjustButton component is a descendant of both the CartProvider and ProductProvider components to access necessary cart and product data.
  • The ProductQuantityAdjustButton component internally utilizes the useCart and useProduct hooks to access cart and product-related functions and data.
  • The adjust prop determines the type of quantity adjustment to perform when the button is clicked.