Is there any reason why component names are always "Unknown"?
Just in case, I'm using browserify and sources are not minified, only concatenated.
Here's how it looks like:
OK, here's quick update: if component is exposed like this, it'll have Unknown
as a name:
exports.MyComponent = React.createClass({...});
However, when I change it to this, it starts to work:
var MyComponent = React.createClass({...});
exports.MyComponent = MyComponent;
I checked extension source code, but can't figure what's tagName
and how it is set.
If you are not using JSX, you need to add a displayName
attribute to your class.
var MyComponent = React.createClass({
displayName: 'MyComponent',
...
});
If you are using JSX, this is done automatically. Unfortunately there isn't a way to get it otherwise.
Yes, I'm using JSX. So, it seems it is different issue - JSX compiler can not contribute displayName
if component is declared with exports.ComponentName = React.createClass()
.
This is the code responsible for it: https://github.com/facebook/react/blob/master/vendor/fbtransform/transforms/reactDisplayName.js#L37
JSX could in theory support your format too. This problem is going away when we move to ES6 classes or something similar though.
The tagName is something that's part of DOM components in React's core. It doesn't have a displayName.
If you want to send a pull request you could add your preferred formats here:
Understood, thanks. Manual displayName
will work for now.
Just made https://github.com/facebook/react/pull/799 which should fix this for all cases that I can think of.
I am using the chrome plugin React Developer Tools
and when I inspect the React tree I see 'Proxy Component' instead of the components actual name. Might be a webpack
issue? I tried adding 'displayName' and that didn't do it.
Anyone else run into this issue?
Most helpful comment
I am using the chrome plugin
React Developer Tools
and when I inspect the React tree I see 'Proxy Component' instead of the components actual name. Might be awebpack
issue? I tried adding 'displayName' and that didn't do it.Anyone else run into this issue?