6 ms·
There is the 1k jsx lib: https://nanojsx.io https://nanojsx.io Then again, if we are at this road now again, maybe they should just bring a lighter version of
by postdb 3y ago
There is the 1k jsx lib: https://nanojsx.io https://nanojsx.io
Then again, if we are at this road now again, maybe they should just bring a lighter version of e4x as part of ES/JS.
- c-smile 3y agoIn Sciter I did just that - JSX is an integral part of JS compiler - patched version of QuickJS : https://gitlab.com/c-smile/quickjspp/-/blob/master/quickjs-jsx.h https://gitlab.com/c-smile/quickjspp/-/blob/master/quickjs-j... So in Sciter this works out of the box: <html> <body/> <script> function HelloWorld() { return <p>Hello <b>world</b></p>; } document.body.append(<HelloWorld/>); </script> </html> JSX expressions are compiled to calls of JSX(tag,atts,kids) function. That function can be redefined enabling different libraries to use JSX in the way they want, here is an example of using JSX with PReact: import { h, render, Component } from 'preact'; JSX = h; // let's use PReact::h() as a driver of JSX expressions See https://gitlab.com/sciter-engine/sciter-js-sdk/-/blob/main/samples/preact/clock.htm https://gitlab.com/sciter-engine/sciter-js-sdk/-/blob/main/s...