UNPKG

@navinc/base-react-components

Version:
15 lines 635 B
export const WaitForDependencies = ({ children, ErrorContent, LoadingContent, loadingProps = [], hasDependencyProps = [], }) => { const hasAllDataDependencies = hasDependencyProps.reduce((accumulator, current) => current && accumulator, true); const areAnyLoading = loadingProps.reduce((accumulator, current) => current || accumulator, false); if (hasAllDataDependencies) { return children; } else if (areAnyLoading && LoadingContent) { return LoadingContent; } else if (ErrorContent) { return ErrorContent; } return null; }; //# sourceMappingURL=wait-for-dependencies.js.map