kossnocorp / react-guard

🦄 React Guard automagically catches exceptions from React components, extracts useful debug information and prevents White Screen of Death 👻
Other
96 stars 6 forks source link

Fix displayName for ES6 class component #5

Closed havenchyk closed 7 years ago

havenchyk commented 7 years ago

Here is a method how React understands component's name https://github.com/facebook/react/blob/b3c75d82b2c8862a461b34167bbef37a3eaa5c46/src/classic/element/ReactElementValidator.js#L68

I guess react-guard can use the same

havenchyk commented 7 years ago

Added some tests. Since property name of the constructor is read only, I just did displayName empty. /cc @kossnocorp

havenchyk commented 7 years ago

@kossnocorp just a friendly ping :)

kossnocorp commented 7 years ago

Thank you! The update was released as 0.4.0:

$ npm publish
+ react-guard@0.4.0
havenchyk commented 7 years ago

awesome!