7 ms·
This is simpler syntax than JSX? Vue: <v-chip v-if="manager.department == 'Engineering'" color="primary" text-color="white" small>{{ manager.department }}</
by debaserab2 9y ago
This is simpler syntax than JSX?
Vue:
<v-chip v-if="manager.department == 'Engineering'" color="primary" text-color="white" small>{{ manager.department }}</v-chip>
JSX:
if (manager.department == 'Engineering') {
return <VChip color="primary" text-color="white" small>{manager.department}</VChip>
}
I dunno about you but I grok code that uses whitespace, braces, and parenthesis to identify branching logic way faster than tag attributes.
- inopinatus 9y agoComparison falls down, because a) you can write JSX in Vue components since that's your preference, and this is explicitly documented and supported: https://vuejs.org/v2/guide/render-function.html#JSX https://vuejs.org/v2/guide/render-function.html#JSX, and b) that first example violates the Vue style guide. https://vuejs.org/v2/style-guide/ https://vuejs.org/v2/style-guide/
- djstein 9y agoif we want we can reduce too: return ( manager.department === 'Engineering' && <VChip color="primary" text-color="white" small>{manager.department}</VChip> )
- kirillseva 9y agothey look pretty similar to me, one is kinda like js-in-html, the other is html-in-js, to each their own. I'm talking more about the whole experience of building out a full app. How do I structure my codebase? Which packages should I use in 2017? It's a much more trivial exercise with vue if you're only doing frontend work occasionally and not as part of your normal job. I have to point out that https://github.com/facebookincubator/create-react-app https://github.com/facebookincubator/create-react-app is great if you do decide to go with React and want answers to aforementioned questions.
- whitefang 9y agoIn vue we have Vue CLI, which is becoming as powerful as create-react-app and it also has nuxt.js https://github.com/vuejs/vue-cli https://github.com/vuejs/vue-cli https://nuxtjs.org/ https://nuxtjs.org/