4 ms·
I love React but you're completely wrong here. Vue has JSX support as well https://github.com/vuejs/babel-plugin-transform-vue-jsx https://github.com/vuejs/babe
by indreklasn 9y ago
I love React but you're completely wrong here. Vue has JSX support as well https://github.com/vuejs/babel-plugin-transform-vue-jsx https://github.com/vuejs/babel-plugin-transform-vue-jsx. JSX isn't a React thing anymore. Most Virtual DOM solutions offer JSX.
Styling React components is a huge pain. What I like about Vue is the awesome styles, HTML and js in one file for each component. With React projects I have a completely seperate styles folder.
- petilon 9y agoThe documentation for view.js seems to highlight a custom syntax that cannot be verified at compile-time: https://vuejs.org/v2/guide/#Conditionals-and-Loops https://vuejs.org/v2/guide/#Conditionals-and-Loops If you are interested in HTML, JavaScript and Styles in one component you really want Web Components. React and view.js support components but they are brittle. W3 Web Components (implemented by Chrome and Safari) solve this problem. More on that here: https://github.com/wisercoder/uibuilder https://github.com/wisercoder/uibuilder
- yunyu 9y agoVue templates are verified at compile time (don't know where you got that from), and static analysis is planned for the future (which isn't directly possible with JSX): https://medium.com/@youyuxi/pretty-good-comparison-overall-but-a-few-points-id-like-to-discuss-e4f6460e75d5 https://medium.com/@youyuxi/pretty-good-comparison-overall-b... There are two distributions of Vue, one in which templates are precompiled (this is the default and recommended build), and one bundling the runtime template compiler. You are most likely thinking of the latter.
- deleted 9y ago[deleted]
- emn13 9y agoHe's definitely not wrong. Vue.js supports and promotes templates (e.g. right on the very "get started" page the homepage links to: https://vuejs.org/v2/guide/#Conditionals-and-Loops https://vuejs.org/v2/guide/#Conditionals-and-Loops) with yet another NIH looping and conditional syntax. Perhaps it's possible to avoid - but that kind of flexibility simply encourages messy codebases.
- sgustard 9y agoJSX is not a requirement for React. React has the same kind of flexibility you are criticizing. https://facebook.github.io/react/docs/react-without-jsx.html https://facebook.github.io/react/docs/react-without-jsx.html
- jolux 9y agoNot a requirement per se, sure, but it's strongly suggested and other usages are not idiomatic.
- tehbeard 9y agoThat is simply skipping the transpiling of JSX, the structure/nesting is the exact same, not some DSL crafted for templating.
- cjalmeida 9y agoReact without JSX is very clunky at best.
- emn13 9y agoThat's not at all the same, for (at least) 2 reasons. - Defaults matter; templates as defaults means most examples, support, tools, extensions, etc. will assume templating. - React without JSX doesn't actually affect the code structure or flow. Looping, conditionals, composition etc. all stay the same; and that shouldn't be surprising since JSX is essentially no more than a slightly different syntax for nested method calls and object literals; which is quite unlike templates in vue; those have actual semantics too. I've used react without jsx before (some time ago for a coffeescript based project), and it affects little. If you do that, you'll want to introduce some alternative shorthand to avoid all those repetitive "React.createElement" calls, but doing so is trivial - after all, it's just method calls and object literals. I'm not a huge fan of custom languages like JSX in general, and indeed JSX too (I believe) was a mistake. However, with sufficient support and a small enough target to support, it's less of an issue. Still, even extremely well funded projects like razor are clearly much less well supported by tooling than the language they're based on, even many years later. Vue's templates? Completely hopeless.
- siliconwrath 9y agoStyled components solves this problem very nicely https://github.com/styled-components/styled-components https://github.com/styled-components/styled-components