react-bem icon indicating copy to clipboard operation
react-bem copied to clipboard

Higher Order Component version?

Open bebraw opened this issue 10 years ago • 6 comments

As mixins won't work with ES6 style classes, would it be feasible to implement a HOC version? That can be easily turned into a ES7 decorator. See baobab-react for practical examples of what these look like.

bebraw avatar Apr 30 '15 06:04 bebraw

Hey bebraw,

Sorry that I'm just now seeing this. I don't know anything about using React's mixins in ES6. So I really can't answer the question in any meaningful way.

I'd definitely be open to a pull request if anyone took a stab at it.

Cheers,

cuzzo avatar Oct 14 '15 20:10 cuzzo

Mixins are problematic with ES6. There's a little hack but hacks are never nice.

I expect implementing a HOC/decorator wouldn't be that difficult. I've documented the approach. Hopefully that helps in case someone wants to do a PR.

bebraw avatar Oct 15 '15 12:10 bebraw

@bebraw,

Sorry for the delay. Finally got around to the newer versions of React and will get to this within the next few days. Thanks so much for the recommendation!

Cheers,

cuzzo avatar Jan 14 '16 19:01 cuzzo

No worries. By the looks of it my docs have moved to an appendix since my previous comment. The book has seen a lot of work since. :+1:

If you have time to set up an online example for react-bem, I'll make sure people in my circles find it.

bebraw avatar Jan 14 '16 19:01 bebraw

Hey @cuzzo, is there any updates? Would you like to accept pr instead?

havenchyk avatar Jun 20 '16 11:06 havenchyk

@cuzzo Started work on a HOC at https://github.com/idmontie/react-bem/pull/1. Unfortunately, I'm using React 15+ in most of my projects and ES6, so it uses webpack. Not sure if you want to have to deal with that in this repo.

idmontie avatar Aug 29 '16 05:08 idmontie