---
title: useCartLine
description: |2-
The `useCartLine` hook provides access to the [CartLine object](https://shopify.dev/api/storefront/unstable/objects/cartline) from the Storefront API. It must be a descendent of a `CartProvider` component.
api_version: 2025-07
api_name: hydrogen-react
source_url:
html: 'https://shopify.dev/docs/api/hydrogen-react/latest/hooks/usecartline'
md: 'https://shopify.dev/docs/api/hydrogen-react/latest/hooks/usecartline.md'
---
# useCartLine
The `useCartLine` hook provides access to the [CartLine object](https://shopify.dev/api/storefront/unstable/objects/cartline) from the Storefront API. It must be a descendent of a `CartProvider` component.
## useCartLine()
`useCartLine` must be a descendent of a `CartProvider` component.
### Returns
* CartLinePartialDeep
### CartLinePartialDeep
* PartialDeep< CartLine | ComponentizableCartLine, {recurseIntoArrays: true} >
### CartLinePartialDeep
```ts
PartialDeep<
CartLine | ComponentizableCartLine,
{recurseIntoArrays: true}
>
```
Examples
### Examples
* #### Example code
##### Description
I am the default example
##### JavaScript
```jsx
import {CartLineProvider, useCartLine} from '@shopify/hydrogen-react';
export function CartWrapper({cart}) {
const firstCartLine = cart.lines.nodes[0];
return (