Skip to content

Instantly share code, notes, and snippets.

@meerfolk
Created January 12, 2017 07:27
Show Gist options
  • Save meerfolk/c29d5d85983376fdde5fb623fd35ab23 to your computer and use it in GitHub Desktop.
Save meerfolk/c29d5d85983376fdde5fb623fd35ab23 to your computer and use it in GitHub Desktop.
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