React Hooks
Customer Hooks
React hooks for orders, profile, wishlist, and reviews
useOrders
const { data } = useOrders({ page: 1, limit: 10 });
// data: { items: OrderListItem[], total, page, totalPages }useOrder
const { data: order } = useOrder('ORD-2026-0042');useOrderTracking
Public tracking — no authentication required:
const { data: order } = useOrderTracking('tracking-token');useCustomerProfile
const { data: profile } = useCustomerProfile();
// profile: { id, email, firstName, lastName, phone }useCustomerAddresses
const { data: addresses } = useCustomerAddresses();
// addresses: { items: CustomerAddress[] }useWishlist
const { data: wishlist } = useWishlist();
const addToWishlist = useAddToWishlist();
const removeFromWishlist = useRemoveFromWishlist();
// Toggle wishlist
const toggle = (productId: string, isInWishlist: boolean) => {
if (isInWishlist) {
removeFromWishlist.mutateAsync(productId);
} else {
addToWishlist.mutateAsync(productId);
}
};useProductReviews
const { data: reviews } = useProductReviews('product-id');
// reviews: { items, averageRating, totalCount, ratingDistribution }useSubmitReview
const submitReview = useSubmitReview();
await submitReview.mutateAsync({
productId: 'product-id',
rating: 5,
title: 'Amazing!',
content: 'Best purchase ever.',
authorName: 'Jan',
});