Most Vue apps need asynchronous HTTP requests and there are many ways to realize them: in the mounted() lifecycle hook, in a method triggered by a ...
For further actions, you may consider blocking this person and/or reporting abuse
Hey, I wanted to introduce this in project in my work. Is this solution working well with post, delete and put requests? My project is really complex. Does it scale well?
You might be interested in my article about this very same topic (funnily enough also inspired by the same podcast episode): Building Renderless Components to Handle CRUD Operations in Vue.js
Whoooa, good solution.
I am trying to reproduce your solution and a question has come up. my goal is to pass
datatorouter-view, I am now passing asprops, but I do not know if it is the best solution?On each page I have a variable corresponding to the page that will work this
data.Do you have any suggestions?
Passing props to
<router-view>is fine in my opinion!ty :p
a problem occured. On some pages, the props
datais expected to be an object, but on others it is an array.I thought I'd give the property multiple types, or is there a better solution?
Solution
LGTM ;)
Great article. Thanks!
Just one point - I think we should start to use Vue.js Function API to wrap this logic as described here:
blog.bitsrc.io/vue-js-3-future-ori...
Thanks! As soon as the first early version of Vue 3 is available I will update this article with the new syntax.
You might want to use multiple words for a component name.
This recommendation is considered essential as a means to prevent conflicts with existing and future HTML elements (since all HTML elements are a single word):
vuejs.org/v2/style-guide/#Multi-wo...
Great article, good job!
Great one. Thanks Lukas.
Thanks :)
Good article :p
Lukas,
Great article, I have a quick question. You advocate doing your API calls in the mounted() hook. I've always read that you should kick off async stuff in created(). Your thoughts?
KLC
Hi Ken,
in fact, I don't know myself which one is better,
mountedorcreatedhook. I pretty much picked one at random :)