The React docs have the following piece of code to extract the name of a component in an HOC (function getDisplayName). See the getDisplayName implementation below.