Skip to main content

React Hooks

The SDK provides React hooks built on TanStack Query for seamless data fetching with caching, background updates, and error handling.

Setup

Wrap your app with QueryClientProvider:

DAO Hooks

useDAOs

Fetch all DAOs with pagination and ordering.

useDAO

Fetch a single DAO by ID.
See Types Reference for full DAO type.

useDAOsByManager

Fetch DAOs managed by a specific address.

Proposal Hooks

useProposals

Fetch proposals with optional filters.

useProposal

Fetch a single proposal by ID.

useProposalsByDAO

Fetch proposals for a specific DAO.

useActiveProposals

Fetch all currently active proposals across all DAOs.

Vote Hooks

useVotes

Fetch votes with optional filters.

useVotesByProposal

Fetch all votes for a specific proposal.

useVotesByVoter

Fetch all votes cast by a specific address.

Delegate Hooks

useDelegates

Fetch delegation records with optional filters.

useDelegatesByDAO

Fetch delegates for a specific DAO.

useDelegationsFrom / useDelegationsTo

Fetch delegations from or to a specific address.

Token Holder Hooks

useTokenHolders

Fetch token holders with optional filters.

useTokenHoldersByDAO

Fetch token holders for a specific DAO.

useTokenHoldingsByAddress

Fetch all token holdings for a specific address across all DAOs.

Query Keys

Each hook exports query keys for cache invalidation with TanStack Query:

Available Query Keys