I read React docs where it was told that by default ReactClass.displayName is defined and = name of class (function). I have two components. Component A and B and export my named functional component B into another place:
import React, { Suspense } from 'react';
import someImportedclassComponentA from 'otherFile.jsx'
export function B(props) {
const A = someImportedclassComponentA;
return (
<Suspense>
<A {...props} />
</Suspense>
);
}
In the other file (after import B) i want to get displayName of B ("B" expected):
let name = B.displayName;
I get undefined but when i do:
let name = B.name;
It works and returns "B". It is mean that function B is recognized as simple function, not React functional component with displayName. How it is possible ? Why it is not react functional component as i expected?