Skip to main content

SDK Hooks

Use SDK hooks for React-based experiences in internal or customer-facing apps.

Step 1: Initialize SDK Provider

  1. Configure the SDK client once in your app shell.
  2. Pass auth/session context through your provider.
  3. Confirm tenant-scoped requests succeed.

Step 2: Read Data with Query Hooks

const { data: projects, isLoading, error } = useProjects();

Step 3: Mutate with Action Hooks

const createProject = useCreateProject();
await createProject.mutateAsync({ name: "New Project" });

Step 4: Handle States Consistently

  • Loading: show skeleton or progress indicator.
  • Empty: show a guided action.
  • Error: show retry plus actionable detail.

Step 5: Keep UI Safe

  1. Disable critical actions when permissions are missing.
  2. Require confirmation for destructive actions.
  3. Invalidate or refresh relevant queries after mutations.

Use hooks inside thin feature components and keep orchestration in dedicated service modules.