GithubHelp home page GithubHelp logo

Comments (8)

klimashkin avatar klimashkin commented on June 10, 2024

@gaearon Seems like I found why
I work in Chrome 51 and there function's name property (ES6) has been implemented:
https://www.chromestatus.com/feature/5135002249461760

And this line in react-proxy use it as displayName, so all components become 'Constructor'
https://github.com/gaearon/react-proxy/blob/13f076b17b43a9d53c151931f3629ef1baae42e5/src/createClassProxy.js#L167

I think new Firefox and Edge have the same issue

from babel-plugin-react-transform.

gaearon avatar gaearon commented on June 10, 2024

How did it work before? I’m not sure what you expect to get because there is no way to infer a display name from export default React.createClass({..}), is there?

from babel-plugin-react-transform.

gaearon avatar gaearon commented on June 10, 2024

As far as I can see, it used to not provide displayName at all.
I don’t think using Constructor is worse in this situation.
The real problem is export default React.createClass leaving us no opportunity to infer displayName—you wouldn’t have this problem if you either exported an ES class, or declared a createClass() class as a separate variable before exporting it.
I’m closing as I don’t see a good solution to this on our side.

from babel-plugin-react-transform.

klimashkin avatar klimashkin commented on June 10, 2024

But what is NextComponent.name? Can it be deleted?

from babel-plugin-react-transform.

klimashkin avatar klimashkin commented on June 10, 2024

As you can see from second message I use https://github.com/articulate/react-transform-display-name for creating DisplayName from filename

from babel-plugin-react-transform.

gaearon avatar gaearon commented on June 10, 2024

https://github.com/articulate/react-transform-display-name is confusing to me because it seems to do what babel-plugin-transform-react-displayname already does, and the second one is part of Babel react preset.

This Babel plugin does indeed seem to conflict with babel-plugin-transform-react-displayname, but I likely won’t be working to fix it because I plan to deprecate it altogether in favor of the solution in gaearon/react-hot-boilerplate#61. If you submit a PR that replicates the logic from babel-plugin-transform-react-displayname for inferring displayName in this particular case with tests, I can merge it, but I won’t personally be working on it.

from babel-plugin-react-transform.

klimashkin avatar klimashkin commented on June 10, 2024

Without https://github.com/articulate/react-transform-display-name all my components are named like ProxyComponent:
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method ofProxyComponent`

I knew about it here #19 (comment)

from babel-plugin-react-transform.

klimashkin avatar klimashkin commented on June 10, 2024

And you are right, everything is fine if I remove babel react-transform plugin, so I'll wait new React Hot Loader 3

from babel-plugin-react-transform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.