Khan / react-components

khan.github.io/react-components/
MIT License
1.01k stars 99 forks source link

remove arrow function from state-from-store #20

Closed bradencanderson closed 9 years ago

bradencanderson commented 9 years ago

Remove the single arrow function in state-from-store, since it was raising a syntax error in Chrome 38. No reason to break compatibility with lots of browsers for a single fat arrow function.

joelburget commented 9 years ago

Hi Braden, thanks for the pull request!

Ideally we'd like all the react components to be usable in all browsers so I'm hesitant to remove ES 6 features from one component, leaving the rest broken for you.

I currently know of two ways to use react-components that should just work:

  1. Use the npm package, which has pretransformed (ES 6 -> ES 5) files (require("react-components/component"))
  2. Use webpack with jsx-loader and react-components as a submodule (require("../react-components/component.jsx"))

I think there's a way to make this work with browserify as well, but I'm not confident since we don't use it anymore.

Anyway, I'd like to get this working properly for you. What's your setup like?

bradencanderson commented 9 years ago

I'm using browserify and gulp to build my js. I think my only problem is that Chrome 38 doesn't support fat arrow functions. Currently I'm only using state-from-store in my project, so this was a relatively quick fix. I think I'll end up using your #1 though, thanks for letting me know about the pretransform!