diff --git a/packages/react-transform/src/index.ts b/packages/react-transform/src/index.ts index 5c83fa936..779bd642f 100644 --- a/packages/react-transform/src/index.ts +++ b/packages/react-transform/src/index.ts @@ -145,16 +145,12 @@ function isOptedOutOfSignalTracking(path: NodePath | null): boolean { function isComponentFunction(path: NodePath): boolean { return ( fnNameStartsWithCapital(path) && // Function name indicates it's a component - getData(path.scope, containsJSX) === true && // Function contains JSX - path.scope.parent === path.scope.getProgramParent() // Function is top-level + getData(path.scope, containsJSX) === true // Function contains JSX ); } function isCustomHook(path: NodePath): boolean { - return ( - fnNameStartsWithUse(path) && // Function name indicates it's a hook - path.scope.parent === path.scope.getProgramParent() - ); // Function is top-level + return fnNameStartsWithUse(path); // Function name indicates it's a hook } function shouldTransform(