mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
17 lines
363 B
TypeScript
17 lines
363 B
TypeScript
import { cloneElement, FC, PropsWithChildren, ReactNode } from 'react';
|
|
|
|
export const ProviderComposer: FC<
|
|
PropsWithChildren<{
|
|
contexts: any;
|
|
}>
|
|
> = ({ contexts, children }) =>
|
|
contexts.reduceRight(
|
|
(kids: ReactNode, parent: any) =>
|
|
cloneElement(parent, {
|
|
children: kids,
|
|
}),
|
|
children
|
|
);
|
|
|
|
export default ProviderComposer;
|