Behio Storefront SDK
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',
});

useCourses

Enrolled online courses of the logged-in customer with progress (see Online Courses):

const { courses, isLoading } = useCourses();
// courses: CourseListItem[] with { courseId, name, slug, imageUrl,
//   totalLessons, completedLessons, enrolledAt, expiresAt, isExpired }

useCourse

Course player payload + lesson completion in one hook. Locked (drip) lessons carry no content until they unlock server-side:

const { course, completeLesson, isCompleting } = useCourse(courseId);
// course: CourseDetail: modules → lessons with isUnlocked/unlockAt/isCompleted

await completeLesson(lessonId); // idempotent, refreshes the course query

On this page