Files
AFFiNE-Mirror/apps/web/src/components/provider-composer.tsx
2023-03-15 11:58:43 -05:00

16 lines
358 B
TypeScript

import type { FC, PropsWithChildren, ReactNode } from 'react';
import { cloneElement } from 'react';
export const ProviderComposer: FC<
PropsWithChildren<{
contexts: any;
}>
> = ({ contexts, children }) =>
contexts.reduceRight(
(kids: ReactNode, parent: any) =>
cloneElement(parent, {
children: kids,
}),
children
);