mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
refactor: remove React.FC for component package (#3575)
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ import { ProviderComposer } from '..';
|
||||
|
||||
test('ProviderComposer', async () => {
|
||||
const Context = createContext('null');
|
||||
const Provider: React.FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const Provider = ({ children }: React.PropsWithChildren) => {
|
||||
return <Context.Provider value="test1">{children}</Context.Provider>;
|
||||
};
|
||||
const ConsumerComponent = () => {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { cloneElement } from 'react';
|
||||
|
||||
export const ProviderComposer: FC<
|
||||
PropsWithChildren<{
|
||||
contexts: any;
|
||||
}>
|
||||
> = ({ contexts, children }) =>
|
||||
interface ProviderComposerProps {
|
||||
contexts: any;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const ProviderComposer = ({
|
||||
contexts,
|
||||
children,
|
||||
}: ProviderComposerProps) =>
|
||||
contexts.reduceRight(
|
||||
(kids: ReactNode, parent: any) =>
|
||||
cloneElement(parent, {
|
||||
|
||||
Reference in New Issue
Block a user