Account

Account

useFlowAccount provides you with callbacks to handle connection:

import { useFlowAccount } from '@doodlesteam/flooks';
import { useAccountContext } from '../contexts/AccountContext';
 
function Component {
  const { dispatch } = useAccountContext();
 
  const account = useFlowAccount({
    onConnect: (connectedAccount) => {
      dispatch({ type: 'accountConnected', payload: connectedAccount });
    },
    onDisconnect: () => {
      dispatch({ type: 'accountDisconnected' });
    },
  });
 
  // Rest of the code...
}