3 ms·
1 language vs 2 intertwined languages is compelling enough for me.
by kgwxd 7y ago
1 language vs 2 intertwined languages is compelling enough for me.
- ng12 7y agoDo you mean JSX? Here you go: import {createElement as h} from "react" const Counter = () => { const [count, setCount] = React.useState(0) return h("div", {}, h("p", {}, `You have clicked the button ${count} times`), h("button", {onClick: () => setCount(count => count + 1)}, "Increment") ) } There are additionally libs like hyperscript (https://github.com/mlmorg/react-hyperscript https://github.com/mlmorg/react-hyperscript) that take the non-JSX approach further. Although honestly, I don't recommend it. JSX is really great even it seems a little unfamiliar.
- ArchReaper 7y agoWhat? JSX allows you to write HTML as though you are actually writing HTML. The '1 language' version requires you to learn language-specific syntax for creating HTML elements. How is that more compelling?
- pgt 7y ago(not= syntax semantics)