Template
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F22Ms5Cxam5UHyxaCrtZzu
12 lines
540 B
TypeScript
12 lines
540 B
TypeScript
import { createCartComponents } from "@shopify/hydrogen/react";
|
|
|
|
import type { cartHandlers } from "./cart-handlers";
|
|
|
|
/**
|
|
* React cart bindings derived from the cart server handlers' type. The
|
|
* `CartProvider` accepts the full handler data envelope (`{cart, errors?}`) as
|
|
* `initialData` — see `hydrogen-cart-ui` / `references/react.md`. Do not unwrap
|
|
* to `data.cart`: `{cart: null}` tells the client the server already checked.
|
|
*/
|
|
export const { CartProvider, useCart, useCartForm } = createCartComponents<typeof cartHandlers>();
|