In this Stack Overflow question:
Comparing two components - is Component X an instance of Component A
Dan Abramov explains the correct way of determining whether a child variable is an instance of a Foo React class. Because return <Foo /> doesn't actually return an instance of Foo, you can't simply use instanceof; instead you have to do:
child.type === Foo.type
That's great, except that I'm using Dan's own library, Redux, and Redux instructs you to wrap your (store-using) components with it's connect function:
connect((a) => a)(
class Foo extends React.Component { //...
)
Unfortunately, doing that changes the .type of Foo elements to the connect function itself:
const x = <Foo />;
console.log(x.type); // connect
So, my question is, is there any way I can figure out what React class an element came from if the React class in question used Redux's connect?