You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sdks/customize/typescript/react-hooks.mdx
+27-4Lines changed: 27 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,28 +164,51 @@ The generated SDK with React Hooks has TanStack Query as a dependency that shoul
164
164
The Speakeasy-generated TypeScript SDK bundles Zod for runtime type validation, and TanStack Query powers the React hooks. TanStack Query is required for the React hooks to function correctly.
165
165
</Callout>
166
166
167
-
### Set up the React Query provider
167
+
### Set up the providers
168
168
169
-
Add the TanStack Query provider to your React application:
169
+
The generated React hooks require two providers to be set up in your application:
170
+
171
+
1.**QueryClientProvider** from TanStack Query for managing query state
172
+
2.**SDK Provider** from your generated SDK for providing the API client instance
The SDK provider makes the API client available to all hooks in your component tree. Replace `your-sdk-package`, `YourSDKCore`, and `YourSDKProvider` with the actual names from your generated SDK.
211
+
189
212
## Basic usage
190
213
191
214
You can use the generated Hooks in your components as follows:
0 commit comments