11---
2- title : ' Flow React SDK Hooks'
2+ title : ' Hooks'
33description : React hooks for interacting with the Flow blockchain.
44sidebar_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
2024import { 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
5763import { 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
95103import { 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
132142import { 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+
163175This 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
174188import { 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
197213import { 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
231249import { 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
273293import { 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
319341import { 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
370394import { 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
431457import { 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
471499import { 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
500530import { 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
529561import { 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
624658import { 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
688724import { 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
761799import { 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
834874import { useCrossVmTransactionStatus } from " @onflow/react-sdk"
835875```
0 commit comments