4 ms·
There's a number of options available if you don't want to use JSX. For example, if you prefer to use small wrapper functions like `h(MyComponent)` and `div()`
by acemarke 8y ago
There's a number of options available if you don't want to use JSX.
For example, if you prefer to use small wrapper functions like `h(MyComponent)` and `div()`, there's `react-hyperscript-helpers` [0].
More recently, Jason Miller published `htm` [1], which provides near-JSX syntax using ES6 template literals, and no build step required. It appears to be a very viable alternative to JSX in many ways.
[0] https://github.com/jador/react-hyperscript-helpers https://github.com/jador/react-hyperscript-helpers
[1] https://github.com/developit/htm https://github.com/developit/htm
- pdimitar 8y agoSure, but your claim of "you just need a pair of <script> tags" is no longer true then, is it? I can start building a house with a hammer and a shovel. Doesn't mean I can build the entire house with them alone.
- acemarke 8y agoMy claim of "you only need two script tags to write a working React app" is entirely accurate. That _does_ limit you to just `React.createElement()`, which is the core React API. If you don't want to call `React.createElement()` every time (whether or not you alias to to something like `h()`), then you either use JSX (and a build step), or one of the other options like the ones I listed. Pointing at that, and then claiming it's insufficient for "building an entire house", makes it look like there's some goalposts being shoved down the field.
- pdimitar 8y agoThe goalpost is -- and always should be -- to build a working app without pretending you don't need a ton of dependencies. You do, unless you have a much bigger time budget than most of us. We can do only so much with a limited toolset. By your analogy, we should only be able to make a working app with `document.write()`. Let's be realistic. A pair of script tags is only theoretically possible and nobody is stopping at that.
- acemarke 8y agoI never made any claims about what other tools you _might_ need to build "real world"-ish apps. I'm only saying that you don't actually need anything else, including build setups, to be able to write working React code, because that's a common misunderstanding about React. Folks assume you _have_ to have Webpack and Babel to use it.
- vinnymac 8y agoAdditionally if you find local development unpleasant you can always try remote development via something like https://codesandbox.io/ https://codesandbox.io/ which will setup a project with everything you need.
- xg15 8y agoTechnically true, but that point isn't really meaningful if the amount of tooling you realistically need to build an app keeps on growing. In theory I only need gcc, vim and a bunch of header files to write the next Chrome as well.