Created
March 12, 2015 12:18
-
-
Save qgustavor/ebefe28a63d00c959b67 to your computer and use it in GitHub Desktop.
Using JSX with jQuery:
This file contains hidden or 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
// Requires: jQuery, Zepto or a library with similar api | |
let React = {createElement: (e, args, ...children) => $(`<${e}>`, args).append( | |
children.map(e => typeof e==='string' ? $('<span>',{text:e}) : e) | |
)}; | |
// Usage: | |
$('.container').append( | |
<div> | |
<h1>Credens Justitiam</h1> | |
<p>Solti ola i <br /> | |
amaliche cantia masa <br /> | |
estia</p> | |
<p>e sonti tolda i <br /> | |
emalita cantia mia <br /> | |
distia </p> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Todo: rewrite this in milthil js.