Virtual DOM as a panacea may be overrated, though. Maybe React's just isn't fast enough, but if you use another way to keep track of what parts of the DOM to change, simply pushing things into the DOM can be WAY faster than using a Virtual DOM. [1]
Cycle.JS still hits my "HTML in code BAD" reaction. An example from the front page:
.map(name =>
h('div', [
h('label', 'Name:'),
h('input.field', {attributes: {type: 'text'}}),
h('h1', 'Hello ' + name)
])
So we're again mixing HTML and JavaScript, and in this case we're also reinventing the syntax. If you're going to mix HTML with JavaScript, at least using standard HTML syntax seems like a better solution.A lot of popular frameworks are using this generated HTML approach, though (including apparently Mithril). I'm still trying to figure out if my negative reaction is justified.
[1] https://aerotwist.com/blog/react-plus-performance-equals-wha...
.map(name =>
div([
label('Name:'),
input('.field', {attributes: {type: 'text'}}),
h1('Hello ' + name)
])
)
Which was inspired by elm-html https://github.com/evancz/elm-html .That's what it is, just an automatic reaction without any real practical argument. Do yourself a favour and "unlearn" that. Open your mind. You're doing yourself a huge disservice by turning away from new ideas with these knee-jerk reactions. Working with views as functions of data gives you much more than it takes away.
On the other hand, every time I turn around I think of more things that it "takes away." This time it's an entire category of tool: The visual layout editor. I like it when my code can be data-driven, and data-driven using a standard format that can be saved using a (visual) tool.
I especially like it when my artists can tweak the page layout for me, but I don't like the idea of giving the artists files full of JavaScript or JSX to tweak.
Are there artist-friendly tools that can edit the layout of a React site/app, where the JSX can be modified in-place using the tool? It doesn't strike me as an impossible-to-solve problem, but it could be tricky to do well.
`h` is method that returns a JavaScript object; not HTML.
[2] http://lhorie.github.io/mithril/ (using its own virtual Dom); I think there are other implementations around, too.
[3] http://cycle.js.org/ (have a native driver)
FYI.