2 ms·
I think the way vue components are composed is perfectly suited for everyone that comes into the frontend story right now. There is no syntax to learn, except
by anonyfox 10y ago
I think the way vue components are composed is perfectly suited for everyone that comes into the frontend story right now.
There is no syntax to learn, except that you can have v-if and v-for in your html elements. A style block contains your CSS like you're used to, plus it can be scoped to a component. A script block contains a bit of local logic and event handlers.
Component = <template> + <script> + <style>. Give it a name with the .vue extension. Now you can use it like a custom HTML tag.
(If you really want JSX you can use it, too. Personally I'm migrating back from JSX to the above way of composing things)
Once you reach a certain complexity threshold in your app, you'll read how others solve this with a "flux architecture", include vuex in a few hours, and have these issues sorted out without hassle or nitpicking dozens of tiny libraries.
Need more "pages"? vue-router is there. Ajax-stuff? vue-resource just works.
Basically there are just 3 common issues left for Vue to become the ideal frontend solution IMO:
1) "official" bootstrap components that play well with vuex
2) a polished "react native" that just works, maybe soon solved by weex
3) SSR without hassle, ideally with a express.js middleware or something like this.
- woah 10y agoWhat does vue resource do that can't be done with fetch?
- iotscale 10y agoWe use knockout at work but <p data-bind="if: foo">foo!</p> quickly turns into <!-- ko if: foo --> <p>foo!</p> <p> because this also depends on foo and I should keep it DRY and adding a parent element just to contain that "if" is silly. </p> <!-- /ko --> Then you start to get comments everywhere and sometimes they don't match and you write server-side helpers to contain them then it becomes a soup of html, your server side templating language and knockout annotations. JSX is way cleaner. We are still probably going to migrate to Vue.js though because it will be easier. (We love Knockout but having performance problems on edge cases.)
- ledak 10y agoYou should consider using React with MobX. Similar concepts, but more powerful and mature.
- vladimir-y 10y ago> 1) "official" bootstrap components that play well with vuex Doesn't vue-strap work well with vue? https://github.com/yuche/vue-strap https://github.com/yuche/vue-strap
- anonyfox 10y agoYes, but not with vuex (model.sync is not an option)