5 ms·
I don't see how Angular does not mix HTML and presentation logic, the point of directives is exactly that. Also, separation of concerns is not about this (it's
by hcarvalhoalves 13y ago
I don't see how Angular does not mix HTML and presentation logic, the point of directives is exactly that. Also, separation of concerns is not about this (it's about encapsulation, see Dijkstra).
> (...) but I do worry a lot of developers will cheat and start emitting snippets of HTML in areas of the codebase that shouldn't be doing that.
This does not make sense. React.js whole point is writing components that do emit HTML and re-render themselves (and children). Now the only thing the developer has to do is react to events (implement callbacks) and change state (setState), the pipeline takes care of the rest. Not only it's impossible to "cheat" by changing the DOM directly from outside the component (a re-render would remove the changes), it's also more work, so it's not cheating at all.
In reality, the clever thing about React is that you start treating data (markup) as code (React.DOM), instead of introducing crutches to work directly with HTML.
- zoomerang 13y agoAngular does mix HTML and presentation logic. That's the point, and this is desirable. Angular does not mix Presentation and Business logic. React doesn't inherently mix the two, but it doesn't dissuade it either. > This does not make sense. React.js whole point is writing components that do emit HTML and re-render themselves (and children). Yes, but it's writing code in Javascript that emits snippets of HTML or DOM. I'm generally not a fan of this approach. Even just just iteration requires jumping between the two, and often breaks up the page into multiple smaller segments in cases where it really doesn't need to me.