babel-plugin-transform-react-stateless-component-name icon indicating copy to clipboard operation
babel-plugin-transform-react-stateless-component-name copied to clipboard

higher-order functions

Open joaomilho opened this issue 8 years ago • 7 comments

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?

joaomilho avatar Mar 20 '16 18:03 joaomilho

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 avatar Mar 24 '16 03:03 wyze

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 avatar Dec 12 '16 00:12 wyze

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

wyze avatar Apr 26 '17 12:04 wyze

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

insidewhy avatar May 10 '17 15:05 insidewhy

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

wyze avatar May 10 '17 15:05 wyze

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

insidewhy avatar May 10 '17 15:05 insidewhy

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

graingert avatar Nov 07 '17 14:11 graingert