4 ms·
Comparing your CoffeeScript example against a vanilla JS React example seems cheap. here's the front page React example in CS: converter = new Showdown.con
by chenglou 12y ago
Comparing your CoffeeScript example against a vanilla JS React example seems cheap. here's the front page React example in CS:
converter = new Showdown.converter()
MarkdownEditor = React.createClass
getInitialState: () -> value: 'Type some *markdown* here!'
handleChange: (e) -> @setState(value: e.target.value)
render: () ->
d = React.DOM
d.div(
d.h3(null, 'Input'),
d.textarea(onChange: @handleChange, value: @state.value),
d.h3(null, 'Output'),
d.div(dangerouslySetInnerHTML: __html: converter.makeHtml(@state.value))
)
React.renderComponent MarkdownEditor(), document.querySelector('.container')
Showing a LOC comparison (and not even from the same dialect of a language) isn't a good proof for what you're trying to demonstrate. Clarity, simplicity, and debuggability all count. Removing a few extra lines of (non-boilerplate) code compared to React doesn't make the library simpler to work with.
- mdiebolt 12y agoI thought about that when constructing the demo but opted to use the JSX / plain JavaScript version because that's what's displayed on the React homepage. We have a strong preference for Haml and CoffeeScript dialects so that's how we present our demos. I built jsfiddles based on how each framework presented their own product.
- chenglou 12y agoIt is indeed displayed on the front page, in vanilla JS, but that doesn't change the fact that it's not a very accurate comparison, providing that the point you're trying to prove is LOC. The React version also showcased attributes such as `className`, which Hamlet didn't. Nothing against CoffeeScript; just picking on the comparison itself. Also, React is a view library, not a full-stack framework. The fact that it's put on the same level as other real JS frameworks is an acknowledgment of its paradigm's power and usefulness. So I guess people viewing it as a framework is a misleading but very telling phenomenon. That being said, good luck with the project!