Skip to content

Instantly share code, notes, and snippets.

@qgustavor
Created March 12, 2015 12:18
Show Gist options
  • Save qgustavor/ebefe28a63d00c959b67 to your computer and use it in GitHub Desktop.
Save qgustavor/ebefe28a63d00c959b67 to your computer and use it in GitHub Desktop.
Using JSX with jQuery:
// 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>
);
@qgustavor
Copy link
Author

Todo: rewrite this in milthil js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment