Update React Profiler reference
This commit is contained in:
parent
9960970550
commit
607349e0b8
1 changed files with 2 additions and 10 deletions
|
@ -20,14 +20,6 @@ type InternalPropsType = Readonly<{
|
||||||
): void;
|
): void;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
function Fallback({ children }: InternalPropsType): JSX.Element {
|
|
||||||
return <>{children}</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BaseProfiler: React.FC<InternalPropsType> =
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
(React as any).unstable_Profiler || Fallback;
|
|
||||||
|
|
||||||
export type PropsType = Readonly<{
|
export type PropsType = Readonly<{
|
||||||
id: string;
|
id: string;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
@ -50,8 +42,8 @@ const onRender: InternalPropsType['onRender'] = (
|
||||||
|
|
||||||
export function Profiler({ id, children }: PropsType): JSX.Element {
|
export function Profiler({ id, children }: PropsType): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<BaseProfiler id={id} onRender={onRender}>
|
<React.Profiler id={id} onRender={onRender}>
|
||||||
{children}
|
{children}
|
||||||
</BaseProfiler>
|
</React.Profiler>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue