hydrogen/packages/hydrogen/src/components/CartLineProductTitle/README.md
2021-11-09 18:20:09 -08:00

1.4 KiB

The CartLineProductTitle component renders a span element (or the type of HTML element specified by the as prop) with the cart line merchandise's title. It must be a descendent of a CartLineProvider component.

Example code

import {
  CartLineProvider,
  useCart,
  CartLineProductTitle,
} from '@shopify/hydrogen';

export function App() {
  const {lines} = useCart();

  return lines.map((line) => {
    return (
      <CartLineProvider key={line.id} line={line}>
        <CartLineProductTitle />
      </CartLineProvider>
    );
  });
}

Alias

The CartLineProductTitle component is aliased by the CartLine.ProductTitle component. You can use whichever component you prefer.

Component type

The CartLineProductTitle component is a client component, which means that it renders on the client. For more information about component types, refer to React Server Components.