Skip to content

Commit 314b199

Browse files
authored
Merge pull request #1494 from onflow/mfbz/react-sdk-overview
Updated React SDK section with overview
2 parents 527bae0 + 5586faa commit 314b199

File tree

8 files changed

+1075
-154
lines changed

8 files changed

+1075
-154
lines changed

docs/blockchain-development-tutorials/cadence/getting-started/building-a-frontend-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ For additional details and advanced usage, refer to the [@onflow/react-sdk docum
459459
[`useFlowQuery`]: ../../../build/tools/react-sdk#useflowquery
460460
[`useFlowMutate`]: ../../../build/tools/react-sdk#useflowmutate
461461
[Dev Wallet]: ../../../build/tools/flow-dev-wallet
462-
[@onflow/react-sdk documentation]: ../../../build/tools/react-sdk/index.md
463-
[**@onflow/react-sdk**]: ../../../build/tools/react-sdk/index.md
462+
[@onflow/react-sdk documentation]: ../../../build/tools/react-sdk
463+
[**@onflow/react-sdk**]: ../../../build/tools/react-sdk
464464
[Flow CLI]: ../../../build/tools/flow-cli/install.md
465465
[Cadence VSCode extension]: ../../../build/tools/vscode-extension

docs/blockchain-development-tutorials/cross-vm-apps/add-to-wagmi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,4 +517,4 @@ For a complete reference implementation, check out the [FCL + RainbowKit + wagmi
517517
[Testnet Cadence Flowscan]: https://testnet.flowscan.io
518518
[Cadence Owned Accounts]: ../../build/cadence/basics/accounts.md
519519
[Testnet EVM Flowscan]: https://evm-testnet.flowscan.io
520-
[pre-built utility from the `@onflow/react-sdk`]: ../../build/tools/react-sdk/index.md#usecrossvmbatchtransaction
520+
[pre-built utility from the `@onflow/react-sdk`]: ../../build/tools/react-sdk#usecrossvmbatchtransaction

docs/build/tools/react-sdk/components.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Flow React SDK Components'
2+
title: 'Components'
33
description: Reusable UI components for Flow interactions.
44
sidebar_position: 3
55
---
@@ -8,6 +8,7 @@ import { Connect, TransactionDialog, TransactionLink, TransactionButton } from "
88
import { FlowProvider } from "@onflow/react-sdk"
99
import FlowProviderDemo from '@site/src/components/FlowProviderDemo';
1010
import TransactionDialogDemo from '@site/src/components/TransactionDialogDemo';
11+
import PlaygroundButton from '@site/src/components/PlaygroundButton';
1112

1213
# React SDK Components
1314

@@ -94,6 +95,8 @@ function MyComponent() {
9495

9596
A drop-in wallet connection component with UI for copy address, logout, and balance display.
9697

98+
<div style={{marginBottom: "1.5rem"}}><PlaygroundButton href="https://react.flow.com/#connect" /></div>
99+
97100
**Props:**
98101

99102
- `variant?: ButtonProps["variant"]` – Optional button style variant (default: `"primary"`)
@@ -128,6 +131,8 @@ import { Connect } from "@onflow/react-sdk"
128131

129132
Button component for executing Flow transactions with built-in loading states and global transaction management.
130133

134+
<div style={{marginBottom: "1.5rem"}}><PlaygroundButton href="https://react.flow.com/#transactionbutton" /></div>
135+
131136
**Props:**
132137

133138
- `transaction: Parameters<typeof mutate>[0]` – Flow transaction object to execute when clicked
@@ -180,6 +185,8 @@ const myTransaction = {
180185

181186
Dialog component for real-time transaction status updates.
182187

188+
<div style={{marginBottom: "1.5rem"}}><PlaygroundButton href="https://react.flow.com/#transactiondialog" /></div>
189+
183190
**Props:**
184191

185192
- `open: boolean` – Whether the dialog is open
@@ -216,6 +223,8 @@ import { TransactionDialog } from "@onflow/react-sdk"
216223

217224
Link to the block explorer with the appropriate network scoped to transaction ID.
218225

226+
<div style={{marginBottom: "1.5rem"}}><PlaygroundButton href="https://react.flow.com/#transactionlink" /></div>
227+
219228
**Props:**
220229

221230
- `txId: string` – The transaction ID to link to

docs/build/tools/react-sdk/hooks.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
2-
title: 'Flow React SDK Hooks'
2+
title: 'Hooks'
33
description: React hooks for interacting with the Flow blockchain.
44
sidebar_position: 2
55
---
66

7+
import PlaygroundButton from '@site/src/components/PlaygroundButton';
8+
79
# React SDK Hooks
810

911
:::info
@@ -16,6 +18,8 @@ Many of these hooks are built using [`@tanstack/react-query`](https://tanstack.c
1618

1719
### `useFlowCurrentUser`
1820

21+
<PlaygroundButton href="https://react.flow.com/#useflowcurrentuser" />
22+
1923
```tsx
2024
import { useFlowCurrentUser } from "@onflow/react-sdk"
2125
```
@@ -53,6 +57,8 @@ function AuthComponent() {
5357

5458
### `useFlowAccount`
5559

60+
<PlaygroundButton href="https://react.flow.com/#useflowaccount" />
61+
5662
```tsx
5763
import { useFlowAccount } from "@onflow/react-sdk"
5864
```
@@ -91,6 +97,8 @@ function AccountDetails() {
9197

9298
### `useFlowBlock`
9399

100+
<PlaygroundButton href="https://react.flow.com/#useflowblock" />
101+
94102
```tsx
95103
import { useFlowBlock } from "@onflow/react-sdk"
96104
```
@@ -128,6 +136,8 @@ function LatestBlock() {
128136

129137
### `useFlowChainId`
130138

139+
<PlaygroundButton href="https://react.flow.com/#useflowchainid" />
140+
131141
```tsx
132142
import { useFlowChainId } from "@onflow/react-sdk"
133143
```
@@ -160,6 +170,8 @@ function ChainIdExample() {
160170

161171
### `useFlowClient`
162172

173+
<PlaygroundButton href="https://react.flow.com/#useflowclient" />
174+
163175
This hook returns the `FlowClient` for the current `<FlowProvider />` context.
164176

165177
#### Parameters:
@@ -170,6 +182,8 @@ This hook returns the `FlowClient` for the current `<FlowProvider />` context.
170182

171183
### `useFlowConfig`
172184

185+
<PlaygroundButton href="https://react.flow.com/#useflowconfig" />
186+
173187
```tsx
174188
import { useFlowConfig } from "@onflow/react-sdk"
175189
```
@@ -193,6 +207,8 @@ function MyComponent() {
193207

194208
### `useFlowEvents`
195209

210+
<PlaygroundButton href="https://react.flow.com/#useflowevents" />
211+
196212
```tsx
197213
import { useFlowEvents } from "@onflow/react-sdk"
198214
```
@@ -227,6 +243,8 @@ function EventListener() {
227243

228244
### `useFlowQuery`
229245

246+
<PlaygroundButton href="https://react.flow.com/#useflowquery" />
247+
230248
```tsx
231249
import { useFlowQuery } from "@onflow/react-sdk"
232250
```
@@ -269,6 +287,8 @@ function QueryExample() {
269287

270288
### `useFlowQueryRaw`
271289

290+
<PlaygroundButton href="https://react.flow.com/#useflowqueryraw" />
291+
272292
```tsx
273293
import { useFlowQueryRaw } from "@onflow/react-sdk"
274294
```
@@ -315,6 +335,8 @@ function QueryRawExample() {
315335

316336
### `useFlowMutate`
317337

338+
<PlaygroundButton href="https://react.flow.com/#useflowmutate" />
339+
318340
```tsx
319341
import { useFlowMutate } from "@onflow/react-sdk"
320342
```
@@ -366,6 +388,8 @@ function CreatePage() {
366388

367389
### `useFlowRevertibleRandom`
368390

391+
<PlaygroundButton href="https://react.flow.com/#useflowrevertiblerandom" />
392+
369393
```tsx
370394
import { useFlowRevertibleRandom } from "@onflow/react-sdk"
371395
```
@@ -427,6 +451,8 @@ function RandomValues() {
427451

428452
### `useFlowTransaction`
429453

454+
<PlaygroundButton href="https://react.flow.com/#useflowtransaction" />
455+
430456
```tsx
431457
import { useFlowTransaction } from "@onflow/react-sdk"
432458
```
@@ -467,6 +493,8 @@ function TransactionDetails({ txId }: { txId: string }) {
467493

468494
### `useFlowTransactionStatus`
469495

496+
<PlaygroundButton href="https://react.flow.com/#useflowtransactionstatus" />
497+
470498
```tsx
471499
import { useFlowTransactionStatus } from "@onflow/react-sdk"
472500
```
@@ -496,6 +524,8 @@ function TransactionStatusComponent() {
496524

497525
### `useDarkMode`
498526

527+
<PlaygroundButton href="https://react.flow.com/#usedarkmode" />
528+
499529
```tsx
500530
import { useDarkMode } from "@onflow/react-sdk"
501531
```
@@ -525,6 +555,8 @@ function ThemeAwareComponent() {
525555

526556
### `useCrossVmBatchTransaction`
527557

558+
<PlaygroundButton href="https://react.flow.com/#usecrossvmbatchtransaction" />
559+
528560
```tsx
529561
import { useCrossVmBatchTransaction } from "@onflow/react-sdk"
530562
```
@@ -620,6 +652,8 @@ function CrossVmBatchTransactionExample() {
620652

621653
### `useCrossVmTokenBalance`
622654

655+
<PlaygroundButton href="https://react.flow.com/#usecrossvmtokenbalance" />
656+
623657
```tsx
624658
import { useCrossVmTokenBalance } from "@onflow/react-sdk"
625659
```
@@ -684,6 +718,8 @@ function UseCrossVmTokenBalanceExample() {
684718

685719
### `useCrossVmSpendNft`
686720

721+
<PlaygroundButton href="https://react.flow.com/#usecrossvmspendnft" />
722+
687723
```tsx
688724
import { useCrossVmSpendNft } from "@onflow/react-sdk"
689725
```
@@ -757,6 +793,8 @@ function CrossVmSpendNftExample() {
757793

758794
### `useCrossVmSpendToken`
759795

796+
<PlaygroundButton href="https://react.flow.com/#usecrossvmspendtoken" />
797+
760798
```tsx
761799
import { useCrossVmSpendToken } from "@onflow/react-sdk"
762800
```
@@ -830,6 +868,8 @@ function CrossVmSpendTokenExample() {
830868

831869
### `useCrossVmTransactionStatus`
832870

871+
<PlaygroundButton href="https://react.flow.com/#usecrossvmtransactionstatus" />
872+
833873
```tsx
834874
import { useCrossVmTransactionStatus } from "@onflow/react-sdk"
835875
```

0 commit comments

Comments
 (0)