ghost-portal/packages/page-tech-comm/src/useCounter.ts
Tarik Gul 384049fb6b
2025 (#11172)
* 2025

* update ci scripts to add access to scripts
2025-01-03 03:59:53 +02:00

20 lines
586 B
TypeScript

// Copyright 2017-2025 @polkadot/app-tech-comm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Hash } from '@polkadot/types/interfaces';
import { createNamedHook, useApi, useCall } from '@polkadot/react-hooks';
const OPT = {
transform: (proposals: Hash[]) => proposals.length
};
function useCounterImpl (): number {
const { api, isApiReady } = useApi();
const counter = useCall<number>(isApiReady && api.derive.technicalCommittee?.proposals, undefined, OPT) || 0;
return counter;
}
export default createNamedHook('useCounter', useCounterImpl);