ghost-portal/packages/test-support/src/react/apiInTests.ts
Jaco e23c8cf152
Bump pjs deps (#9794)
* Bump pjs deps

* Some cleanups

* Additional fixes

* Additional fixes

* kilt

* Additional fixes

* Headers

* Additional headers

* Additional

* Additional

* Additional

* Additional

* It seems to lint... locally.

* It seems to build... locally.

* Review adjustments
2023-08-19 09:38:42 +03:00

15 lines
534 B
TypeScript

// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PropsWithChildren } from 'react';
import type React from 'react';
import { useApi } from '@polkadot/react-hooks';
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
export const WaitForApi = ({ children }: { children: React.ReactNode }): PropsWithChildren<any> | null => {
const api = useApi();
return api.isApiReady ? (children) : null;
};