wyze / babel-plugin-transform-react-stateless-component-name

Adds a display name to the stateless component in the React Dev Tools.
MIT License
32 stars 8 forks source link

higher-order functions #2

Open joaomilho opened 8 years ago

joaomilho commented 8 years ago

Ex1: This works

const higher1 = (fn) => fn
export default higher1(MyComponent)

Ex2: This doesn't

const higher2 = (fn) => (props) => fn(props)
export default higher2(MyComponent)

I suppose this is a tricky use case, but being able to leverage higher order functions (in this case to pre-manipulate props) is a common thing when coding with a more functional style.

Is there any workaround?

wyze commented 8 years ago

Sorry for the lack of response. I tried messing with this tonight and I was able to get it working a little bit by assigning the anonymous functions of higher2 an id in the AST. I am still new to ASTs, but it is going to take a little more time to get this figured out the right way.

wyze commented 7 years ago

Hey @joaomilho, if this is still an issue, can you try out the new release v1.1.0 and let me know. If its still an issue, please can you show input code and what you expect the output to look like please.

wyze commented 7 years ago

Closing with lack of response. More than happy to reopen if this is still an issue.

insidewhy commented 7 years ago

@wyze Just tested with version 1.1.1, the reported issue is still there, can you reopen this?

wyze commented 7 years ago

Sure, do you have a small snippet of actual code you could provide and what the expected output is?

insidewhy commented 7 years ago

The example @joaomilho provided still doesn't work. It's as trivial as you can make the issue.

graingert commented 6 years ago

@wyze @ohjames is this related: https://github.com/wyze/babel-plugin-transform-react-stateless-component-name/pull/9 ?