Comment

Comment by octref

Have to do some clarification here on the point of "Unclear architectural patterns", as the article is way too misleading.

- The reason the API call is made at `created` lifecycle is that the video is a quick, 5 minute intro for beginners. Beginners, as in "people who are familiar building static websites using html/css/js". There is no need to bring in Vuex or vue-router yet. In fact the whole beginner example can be put into a single HTML file by including a Vue script tag. The approachability is what made Vue shine. Some other frameworks assume that you want a build tool, state management, client side routing etc and beginners spend hours configuring those tools and figuring out state management and client-side routing, instead of doing real work.

> To answer to my initial question: API logic should not be written in Vuex nor in components. There is even a good example on how do that in some of the official code examples.

- The example[0] clearly has the API logic in the Actions. The `/api` folder is a mocked API for illustration purpose.

[0]: https://github.com/vuejs/vuex/blob/dev/examples/shopping-car...

parent octref 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton