Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

use-byok.ts

6 lines257 Bytes

1import { useSyncExternalStore } from 'preact/compat'
2import type { ByokClient, ByokSnapshot } from '@tanstack/ai-client/byok'
3​
4export function useByok(client: ByokClient): ByokSnapshot {
5 return useSyncExternalStore(client.subscribe, client.getSnapshot)
6}