Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In 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-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/s...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: