React Hooks
React hooks for the Dimes SDK — data fetching, the interactive quote flow, and live WebSocket updates, all on top of TanStack Query.
Provider setup
import { DimesClient, JwtAuth } from "@dimes-dot-fi/sdk";
import { DimesProvider } from "@dimes-dot-fi/sdk/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const queryClient = new QueryClient();
const client = new DimesClient({
auth: new JwtAuth({ tokenUrl: "https://your-backend.com/api/dimes-token" }),
});
function Root() {
return (
<QueryClientProvider client={queryClient}>
<DimesProvider client={client}>
<App />
</DimesProvider>
</QueryClientProvider>
);
}Data hooks
Hook
Returns
Endpoint
usePositions options
usePositions optionsQuote hooks
useQuote — one-shot
useQuote — one-shotuseQuoteMachine — interactive
useQuoteMachine — interactivePartial fill
Stream hooks
What's next
Last updated

