6 ms·
Building a board game with React.js
- couchand 12y agoI’m a huge fan of CoffeeScript and use it wherever I can... It works for the most part but I had to straddle the syntactical line between brittle and overwrought, with all of the extra brackets. I don't know what extra brackets are referred to here without code samples, but based on the link to Vjeux's post [0], they are completely unnecessary, given the behavior of React vis-a-vis multiple parameters and CoffeeScript with syntactic whitespace and object literals, at least as of CoffeeScript 1.7... For instance, the example: {div, h3, textarea} = React.DOM (div {className: 'MarkdownEditor'}, [ (h3 {}, 'Input'), (textarea {onKeyUp: @handleKeyUp, ref: 'textarea'}, @state.value ) ]) Could be written with far less punctuation as: {div, h3, textarea} = React.DOM div className: 'MarkdownEditor' h3 {}, 'Input' textarea onKeyUp: @handleKeyUp ref: 'textarea' @state.value (Though I usually pass null as the empty param to make it feel worse...) [0]: http://blog.vjeux.com/2013/javascript/react-coffeescript.html http://blog.vjeux.com/2013/javascript/react-coffeescript.htm...