Overview
Jordan adds the new checkout nav to Fieldkit’s React app. Hooks are bound once in a client-only module so server code can importFlagDefinitions without pulling React.
shipd’s own dashboard does this via (useFlag("audit-log"), useVariant("rules-editor")).
Bind hooks
src/lib/shipd.ts
createShipdReact in typegen output. shipd pull / types gen emit types only.
Create the client and wrap
src/app/providers.tsx
client.subscribe:
Read flags
src/components/CheckoutNav.tsx
useFlag("search-variant") does not type-check — that key is a variant. useVariant("new-checkout") does not type-check either.
Hooks re-render when a new snapshot applies or when
identify / reset changes context.
Dogfood: the shipd dashboard
apps/web/src/lib/shipd.ts
rules-editor: "v1", audit-log: false) so local dashboard boots without hosted KV.
Next
- How-to: Use React hooks
- SDK reference