import { Splash } from '@vegaprotocol/ui-toolkit'; import { ReactNode } from 'react'; interface AsyncRendererProps { loading: boolean; error: Error | undefined | null; data: T | undefined; children: (data: T) => ReactNode; } // eslint-disable-next-line export function AsyncRenderer({ loading, error, data, children, }: AsyncRendererProps) { if (error) { return Something went wrong: {error.message}; } if (loading || !data) { return Loading...; } return <>{children(data)}; }