News for hackers. Stuff that matters.
Re:What the Flux? by rubiquity on Tuesday January 27, 2015 @12:32PM (#8954399)
I started using React around 0.4 and I would recommend skipping Flux at first (or entirely) and just learning React. I've helped get a lot of people interested in checking out React and since Flux has come into existence that has tripped up just about every single one of them. Flux is just too much, too soon, and whether you need Flux at all is up for debate.
Re:What the Flux? by teddythetwig on Tuesday January 27, 2015 @12:35PM (#8954420)
Agreed, although for a different reason. When you start using React.js in your frontend, you will eventually run into limitations, such as changing data in sibling components. It is good to know what you can and can't do with React. Then you get to experience the magic of Flux, and everything that made you hate React is possible with the combination. It's like eating your vegetables first... then you get the steak!!
Re:What the Flux? by caseywebdev on Tuesday January 27, 2015 @02:01PM (#8954962)
> such as changing data in sibling components

[Cursors] can help a lot with this problem. As far as sibling/child components know, they own the state, but they're really using immutability helpers to update a larger encompassing state object.

[Cursors]: https://github.com/caseywebdev/cursors

Re:What the Flux? by mercer on Tuesday January 27, 2015 @01:36PM (#8954798)
Alternatively, you could use Reflux.js[1] for a simplified Flux-implementation that is probably enough for smaller apps. I use it in combination with React.js, or Ractive.js, depending on my or my client's needs. Ractive.js, which uses mustache templates, is particularly useful if one needs to collaborate with people who cannot use JSX or are wary of it. And it's pretty useful for smaller projects too.

[1]: https://github.com/spoike/refluxjs

Re:What the Flux? by rashkov on Wednesday January 28, 2015 @10:30AM (#8960320)
There is actually an html to jsx compiler available [1]. I've had good luck using it against HTML templates that were handed to me by a designer.

[1] http://facebook.github.io/react/html-jsx.html

Re:What the Flux? by mercer on Wednesday January 28, 2015 @12:14PM (#8961072)
Interesting. Would make it much easier for me alleviate concerns and be able to use React for projects. Thanks!
Re:What the Flux? by kansface on Tuesday January 27, 2015 @04:10PM (#8955926)
I think it would be quite difficult to build a meaningful app with React and not use something Flux-like. My own experience went like this:

I started off by putting all state in Elements, because that is what the React docs encourage. Eventually, I needed to persist the state and/or access it outside the element (because it is actual fucking state used for business logic). At that point in time, I tried passing callbacks into the Elements per the docs. Of course, this is ridiculously cumbersome when the element is nested 5 or 6 levels below the entry point. Then, I tried hooking up Backbone models and sucking data out of those but two way data binding turned my code into spaghetti. Enter flux! This was perhaps a week or two of pain we can spare others.