SDK Hooks
Use SDK hooks for React-based experiences in internal or customer-facing apps.
Step 1: Initialize SDK Provider
- Configure the SDK client once in your app shell.
- Pass auth/session context through your provider.
- 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
- Disable critical actions when permissions are missing.
- Require confirmation for destructive actions.
- Invalidate or refresh relevant queries after mutations.
Recommended Pattern
Use hooks inside thin feature components and keep orchestration in dedicated service modules.