Closed evocateur closed 8 years ago
Looks sensible. You don't need a babel pipeline for the test though, you just need to write similar code to what babel would produce, which is:
function MyComponent() {}
MyComponent.prototype = Object.create(React.Component);
MyComponent.prototype.render = function() {
return <div />;
}
Classes are just functions, in the above example, MyComponent.name == 'MyComponent'
.
Added a test via cfb3c18
I'm still pretty new to the whole Babel + ES2015 + React ecosystem. Thanks for correcting my misunderstanding!
There's a bit of a backlog on travis at the moment, but once it catches up I'll cut a new release.
Awesome, thanks.
On Sep 26, 2015, at 08:40, Glen Mailer notifications@github.com wrote:
There's a bit of a backlog on travis at the moment, but once it catches up I'll cut a new release.
— Reply to this email directly or view it on GitHub.
v0.6.1
Based on the discussion of this Babel issue and the solution in this pull request, this adds a
getComponentName()
function that provides a forward-looking fallback to the staticdisplayName
property.Unfortunately, writing a test to validate this in the current setup is impossible, as it requires a Babel pipeline. I've linked it locally into a project that uses ES2015 classes for React components, and it works swimmingly. The change is fully backward-compatible, in any case.