So what would a standardized JSX syntax output? It can't be document.createElement since that is a web API and not a generic JS API. So what would it do, exactly?
So what would a standardized JSX syntax output? It can't be document.createElement since that is a web API and not a generic JS API. So what would it do, exactly?
http://tolmasky.com/2016/03/24/generalizing-jsx/
We use this generic-jsx in DemoKit: https://github.com/runkitdev/demokit , and it's really cool because you can do fancy stuff like:
// Curry your JSX tags!
const wordmark = <span style = "font-face:custom; font-weight:bold" />;
.... <wordmark>hello</wordmark>6 years ago I wrote a proof of concept to replace a large Rails application in pure JS using prototypes and constructing the html from strings. The latter turned out to be the most messy part so I stopped that and rather refactored the legacy Rails code to do something useful.
Could be really great for super lightweight JS apps!
JSX is much like other generic user interface markup languages[0] and like many other is simply a dialect of XML. Any interface that can be represented with XML/HTML or any other markup language can use JSX and optionally react. We are already seeing this boom with in native mobile environments with React Native, NativeScript, Titanium...
Here are several examples where JSX is used that is not a browser:
- Native desktop apps for Linux, Mac, and Windows (Not including Electron/NW.js)[1][2][3][4]
- TVs with AppleTV apps or Netflix's Gibbon[5][6]
- Command line apps as stdin/stdout with react-blessed[7]/mylittledom[8]
- Direct to Canvas[9]/pixi.js[10]
- Latex documents[11]
- Web Audio[12]
- Conole.logs[13]
- Truly custom direct to hardware[14] as some C code like: `digitalWrite(led, HIGH)`
I definitely believe JSX could use standardization separate from any implementation, JavaScript or otherwise.
[0]: https://en.wikipedia.org/wiki/User_interface_markup_language
[1]: https://github.com/sidorares/react-x11
[2]: https://github.com/grassator/react-qml
[3]: https://github.com/ptmt/react-native-macos
[4]: https://github.com/Microsoft/react-native-windows
[5]: https://github.com/ramitos/react-tvml
[6]: https://www.youtube.com/watch?v=eNC0mRYGWgc
[7]: https://github.com/Yomguithereal/react-blessed
[8]: https://github.com/manaflair/mylittledom
[9]: https://github.com/Flipboard/react-canvas
[10]: https://github.com/Izzimach/react-pixi
[11]: https://github.com/vzaccaria/jsx-latex
[12]: https://github.com/FormidableLabs/react-music
if would mean that jsx would look something like
function helloEl() {return jsx <div> Hello ${name}! </div>}
as opposed to function helloEl() {return <div> Hello {name}! </div>}
It would be a bit different though in what is actually going on though. The top example would just desugar to jsx.div(`Hello ${name}`)
jsx would be looked up like any other variable. So you could just define it in global scope to point to ReactDOM1: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...