useFlowDisconnect
Hook for handling the disconnection process from the Flow blockchain.
Import
import { useFlowDisconnect } from '@doodlesteam/flooks';
Usage
const MyComponent = () => {
const { disconnect, disconnectAsync } = useFlowDisconnect();
const handleDisconnect = async () => {
try {
await disconnectAsync();
console.log('Disconnected from Flow');
} catch (error) {
console.error('Disconnection failed:', error);
}
};
return <button onClick={disconnect}>Disconnect from Flow</button>;
};
API Reference
Return Value
useFlowDisconnect
returns an object with the following properties:
disconnect
: A function to initiate the disconnection process synchronously.disconnectAsync
: An async function to initiate the disconnection process and handle it asynchronously.- Additional properties and methods from
useMutation
of@tanstack/react-query
which can be used for more advanced handling.
Example
const { disconnect } = useFlowDisconnect();
// Use the disconnect function in your component
<button onClick={disconnect}>Disconnect from Flow</button>
Last updated on