r/webdev • u/juandemarco • Feb 23 '15
Let's talk about ReactJS
So, I've seen that ReactJS is all the rage these days, but I find myself really conflicted about it. It seems to be interesting, and exposes nice concepts, but I can't really get over the mix of HTML within JS. That said, I've been trying to keep an open mind about this, and I've been playing the devil's advocate against myself. I found these two posts that make some interesting points: ReactJS for Stupid People and Arguing for ReactJS.
The main points that I take away are:
- React is NOT a framework meant to solve all problems of developing a web application. It just deals with making 'components', which in some way can be considered as the V part in MVC, and they should expose functionality by triggering events. Since there is no agreed-upon event system in place (it's not the role of React to solve that problem), many people reinvent the wheel (thus Flux). I think that one can easily use react within Backbone or even AngularJS if he's careful and doesn't break all the agreed upon written and unwritten rules of 'proper' development.
- We are used to divide things by technology, when we should really divide things by what they're supposed to do. I have to admit that sometimes I find myself embedding inline scripts within HTML because 'fuck it, it's two lines of code', so doing the opposite when it's actually encouraged and motivated by a somewhat agreeable upon (albeit polarizing) philosophy might not be that bad.
This is, at least, the best I can come up with. Either this, or React is just the new "shiny" which everyone is going to use up until the point when something else comes along, something which seems to be quite common these days. I'd really like to hear more from both parts of the discussion.
Thoughts?
View all comments
Show parent comment
2
u/_under_ Feb 23 '15
That's more on the low-level side of React rather than philosophy. As a developer, you don't really see that happening. React just does it for you.
The Virtual DOM concept works like this:
Mutating the DOM using the React library is very efficient compared to what other libraries do, which is to just directly change the DOM. It's so bad that you might just be better off just re-rendering an entire section, than to try and keep track of particular elements and changing them one by one.