Created
January 12, 2017 07:27
-
-
Save meerfolk/c29d5d85983376fdde5fb623fd35ab23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import react.ReactDOM; | |
import react.ReactMacro.jsx; | |
import react.ReactComponent; | |
import js.Browser; | |
class Main extends ReactComponent { | |
var els : Array<String> = ["1", "2", "3"]; | |
public static function main() { | |
ReactDOM.render(jsx('<Main/>'), Browser.document.getElementById('app')); | |
} | |
override function render() { | |
return | |
jsx(' | |
<table> | |
<tbody> | |
${renderEls()} | |
</tbody> | |
</table> | |
'); | |
} | |
public function new(props : Dynamic = null) { | |
super(props); | |
} | |
function renderEls() { | |
return | |
[ | |
for (el in els) | |
jsx(' | |
<tr> | |
<td>${el}</td> | |
</tr> | |
') | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment