3 ms·
JSX is JS. While there's technically 'parsing' involved, it's fundamentally just syntactic sugar: import { createElement as e } from 'whatever' return
by crooked-v 9y ago
JSX is JS. While there's technically 'parsing' involved, it's fundamentally just syntactic sugar:
import { createElement as e } from 'whatever'
return e(App, {}, [
e(Window, { title: 'Example', size: { w: 300, h: 300 }, menuBar: false }, [
e(Button, { stretchy: false, onClick: () => console.log('Hello') }, [
'Button'
])
])
])
- c-smile 9y ago"JSX is JS" It is not, https://facebook.github.io/jsx/ https://facebook.github.io/jsx/ It is handled by transpiler - one more parsing layer in loading sequence of your application.
- azerothian 9y agosounds like you have your project configured wrong, transpiling should impact compilation not the loading aspect of your application
- mlsarecmg 9y agoThe transpiler is a build build (a babel plugin), it isn't even a part of the application nor does it run while loading. The snippet above turns into a bunch of nested functions.
- tannhaeuser 9y agoNo it isn't, in the sense that it's not part of a language spec for JavaScript, like E4X (now deprecated) once was considered to become. But I guess E4X's problem was that it was too far ahead of its time and had XML in its name. [1]: https://developer.mozilla.org/en-US/docs/Archive/Web/E4X https://developer.mozilla.org/en-US/docs/Archive/Web/E4X