hooks APIs
- useActiveWeb3React
- useApi
- useDebounce
- usePersistentState
- useOutsideClick
- useEventListener
- useEvents
- useSubscription
- useCodeUpload
- useProgram
- useChangeEffect
- useBodyScrollLock
- useBlocks
- usePrefixedTranslation
- useAlert
- useAccounts
- useLoggedInAccount
- useBalanceSubscription
- useOwnersNft
- useMarketplace
- useNft
- useMarketNft
- useEditor
- useLoading
- usePageVisibility
- useHubspotForm
- useAnalyzer
- useMailchimp
- useLoggedIn
- useUuid
- useEscToClose
- useLockBody
- useDrag
- useIsMounted
- useOnImageLoad
- useOnScreen
- useIsDesktop
- useInfiniteScroll
- useDomainApi
- useURQL
- useQuery
- useURLParser
- usePagination
- useQueryParams
- useRegisterRecentVisit
- usePopUp
- useFormProgress
- useTextClip
- useDocumentTitle
- useInitTransak
- useEagerConnect
- useInactiveListener
- useTheme
- useERC20
- useNftMessage
- useDocumentApi
- useDocumentSet
- useNotify
- usePortal
- usePopupClose
- useScrollToggler
- useMediaQuery
- useBooleanState
- useAccount
- useMarketplaceMessage
- useInput
- useToggle
- useIPFS
- useForm
Other Related APIs
hooks#useAccounts TypeScript Examples
The following examples show how to use
hooks#useAccounts.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Account.tsx From gear-js with GNU General Public License v3.0 | 6 votes |
function Account() {
const { account } = useAccount();
const accounts = useAccounts();
const [isModalOpen, setIsModalOpen] = useState(false);
const openModal = () => {
setIsModalOpen(true);
};
const closeModal = () => {
setIsModalOpen(false);
};
return (
<>
{account ? (
<Wallet balance={account.balance} address={account.address} name={account.meta.name} onClick={openModal} />
) : (
<Button icon={userSVG} text="Sign in" onClick={openModal} />
)}
{isModalOpen && <AccountsModal accounts={accounts} close={closeModal} />}
</>
);
}