Work with compile-to-JS languages (like CoffeeScript)
See original GitHub issueJSX is nice, but those using compile-to-JS language have to change the transpiler to connect to the JSX compiler. Is there any chance of adding alternative DOM syntax to JSX so it does not break every compile-to-JS language? Something gettext
-style would be nice. So in addition to:
var HelloMessage = React.createClass({
render: function() {
return <div>{'Hello ' + this.props.name}</div>;
}
});
it would be nice to support
var HelloMessage = React.createClass({
render: function() {
return _dom_("<div>{'Hello ' + this.props.name}</div>");
}
});
Issue Analytics
- State:
- Created 10 years ago
- Comments:33 (20 by maintainers)
Top Results From Across the Web
20 best alternatives to CoffeeScript as of 2022 - Slant.Co
Compiles to multiple platforms and languages · Bad support in some popular IDEs · Powerfully expressive but easy to learn · You need...
Read more >10 Languages That Compile to JavaScript - SitePoint
This article includes a list of ten interesting languages that can compile to JavaScript to be executed in the browser or on a...
Read more >Languages that compile to JS (from CoffeeScript wiki) · GitHub
LiteScript Literate, highly-readable, type annotated, imperative language that compiles to JavaScript. ColaScript similar to Dart, CoffeeScript, Python and PHP ...
Read more >What are some simple but powerful compile-to-JS languages I ...
I'm working on Firefly, which will compile to JS once bootstrapping is complete (almost there). It's a curly brace language like JavaScript, ...
Read more >altJS compile-to-JavaScript language list - GitHub Pages
Sibilant An expandable JavaScript-like language inspired by Lisp. ... LiveScript Coco but much more compatible with CoffeeScript, more functional, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Another way to support at least CoffeeScript could be to make the component constructor a little more lenient. I’ve been playing a little with this, and my favorite syntax so far is something like this:
That is:
And, since CoffeeScript is a bit weird, combine multiple “props” objects into one. (CoffeeScript turns that last line into:
).
It may not be HTML, but it is quite readable IMHO.
👍 @KyleAMathews