ghost-portal/packages/react-hooks/src/useNextTick.ts
Jaco 0de8a8d2ff
Add waiting list to next-gen staking (#8896)
* Add waiting list to next-gen staking

* Extract use* types

* Adjust useHeartbeat checks

* Adjust with useNextTick

* Adjust for useNextTick

* Points anim via ref

* Adjust
2023-01-31 11:56:37 +02:00

21 lines
525 B
TypeScript

// Copyright 2017-2023 @polkadot/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { useEffect, useState } from 'react';
import { nextTick } from '@polkadot/util';
import { createNamedHook } from './createNamedHook';
function useNextTickImpl (): boolean {
const [isNextTick, setIsNextTick] = useState(false);
useEffect((): void => {
nextTick(() => setIsNextTick(true));
}, []);
return isNextTick;
}
export const useNextTick = createNamedHook('useNextTick', useNextTickImpl);