Hook for initiating a connection with the Flow blockchain.


import { useFlowConnect } from '@doodlesteam/flooks';


const MyComponent = () => {
  const { connect, connectAsync } = useFlowConnect();
  const handleConnect = async () => {
    try {
      await connectAsync();
      console.log('Connected to Flow');
    } catch (error) {
      console.error('Connection failed:', error);
  return <button onClick={connect}>Connect to Flow</button>;

API Reference

Return Value

useFlowConnect returns an object with the following properties:

  • connect: A function to initiate the connection process synchronously.
  • connectAsync: An async function to initiate the connection process and handle it asynchronously.
  • Additional properties and methods from useMutation of @tanstack/react-query which can be used for more advanced handling.


const { connect } = useFlowConnect();
// Use the connect function in your component
<button onClick={connect}>Connect to Flow</button>