4 ms·
Just FYI, you can easily include a @babel/standalone script to get JSX in your script tags. https://reactjs.org/docs/add-react-to-a-website.html#quickly-try-j
by namuol 8y ago
Just FYI, you can easily include a @babel/standalone script to get JSX in your script tags.
https://reactjs.org/docs/add-react-to-a-website.html#quickly-try-jsx https://reactjs.org/docs/add-react-to-a-website.html#quickly...
- pier25 8y agoOh this is good! How is the browser support for this?
- acemarke 8y agoNote that running the transform in-browser on anything more than a "hello world" is going to be relatively slow. It's only useful for cases like a "single HTML file React example, with JSX syntax capability", and is _not_ recommended for any kind of production use.
- pier25 8y agoThanks, I saw that after writing my comment. It seems Vue is definitely the simpler choice to write reactive components in projects without a build chain.
- acemarke 8y agoAs I wrote up-thread, Jason Miller's `htm` library seems to be a very nice alternative to JSX that does not require a build step: https://github.com/developit/htm https://github.com/developit/htm
- pier25 8y agoThat might work in some use cases, but unfortunately tagged template literals require greenfield browsers. Vue 2 works in anything that runs ES5.
- bufferoverflow 8y agoIt works well, but so slowly. I tried it for a real project, decided against it. Precompiling JSX into ES6 works fine, and the result is incredibly fast.