diff --git a/packages/npm-react/src/index.ts b/packages/npm-react/src/index.ts index 0d349aa1..c5813c4d 100644 --- a/packages/npm-react/src/index.ts +++ b/packages/npm-react/src/index.ts @@ -57,6 +57,8 @@ export const withBatching = (ctx: Ctx): Ctx => { } } +const anonFnName = (() => () => {})().name + export const reatomContext = React.createContext(null) export const useCtx = (): Ctx => { @@ -217,6 +219,7 @@ export const reatomComponent = ( name?: string, ): ((props: T extends PropsWithCtx ? P : T) => JSX.Element) => { if (name) name = `Component.${name}` + else if (Component.name !== anonFnName) name = Component.name else name = __count('Component') let rendering = false