coffee-react
coffee-react copied to clipboard
Comments in cjsx
Can i use comments in html part of cjsx? Thanks!
Official JSX doesn't support comments and I'm not particularly inclined to add
<!-- html style comments -->
to CJSX because they would have to be special-cased in the parser.
It would be really nice to have some way of doing this — could we make {# foo }
work?
That wouldn't really make sense. Hash-comments go to the end of the line, so how would we differentiate a curly bracket which is just part of the comment from one which closes a coffeescript expression in JSX markup?
I would add a special case for when the curly brace is at the end of the line. At the moment it's a syntax error, so it won't break anyone's existing code.
<ul>
<li />
{# blah'di'blah}
<li />
</div>
+1
I've sent a pull request that implements my suggestion above, would love to get some feedback :).
I'm not sure since when, but JSX does seem to support comments: http://facebook.github.io/react/docs/jsx-in-depth.html#comments
Interesting. I'm in favour of implementing comments with the same semantics as JSX
Would love to see the JSX comments added {/* comment */}
@chasedeanda you can now use {# comment }, which does the same thing :)
Thanks!
Was hoping this would work for commenting multi-line JSX in CoffeeScript 2:
THREE POUND CHARACTERS JSX HERE THREE POUND CHARACTERS
but I get this error: