Skip to Content

React SDK

Build reactive Foundry apps with @osdk/react hooks backed by one shared, normalized cache.

@osdk/react wraps the OSDK client in hooks. Every hook reads from one normalized cache, so a list, a detail view, and a link panel that show the same object stay in sync, and an action updates them all without manual refetching.

src/EmployeeList.tsx
import { useOsdkObjects } from "@osdk/react";
import { Employee } from "@my-app/sdk";

export function EmployeeList() {
  const { data, isLoading, error } = useOsdkObjects(Employee, {
    where: { department: "Engineering" },
    orderBy: { fullName: "asc" },
  });

  return (
    <section aria-busy={isLoading}>
      {error != null && <p role="alert">Could not load employees.</p>}
      <ul>
        {data?.map((employee) => (
          <li key={employee.$primaryKey}>{employee.fullName}</li>
        ))}
      </ul>
    </section>
  );
}

New to OSDK? Start with the Quickstart, then create a client and add OsdkProvider.

Hooks

HookUse it toGuide
useOsdkObjectsLoad a list of objects with filters, sorting, and pagingQuery objects
useOsdkObjectLoad one object by primary keyQuery objects
useLinksLoad the objects linked to an objectFollow links
useObjectSetCombine, intersect, subtract, or pivot object setsWork with object sets
useStableObjectSetKeep an object set referentially stable across rendersWork with object sets
useOsdkAggregationCount, sum, average, and group on the serverAggregate data
useOsdkActionApply and validate actionsApply actions
useDebouncedCallbackDebounce validation while a user typesApply actions
useOsdkFunction, useOsdkFunctionsCall Ontology functions with cachingCall functions
useObservableClientInvalidate cached data by handInvalidate the cache
useOsdkClientGet the client for one-off, imperative callsCreate a client
useOsdkMetadataRead object and action type metadataReference

User, group, and marking hooks live in @osdk/react/platform-apis; see Users and markings. Test utilities live in @osdk/react/testing; see Test your app.

How data flows

On this page