After reading one of Alligator.io posts about Vue that was saying that mounted lifecycle is a bad place to use http get. I was wondering if there are any guidelines to how prope
The created()
lifecycle hooks fullfills all requirements for fetching and processing API data.
However the official Vue documentation uses the mounted()
lifecycle hook in example code for integration API calls with axios:
https://vuejs.org/v2/cookbook/using-axios-to-consume-apis.html
Both lifecycle hooks mounted()
and created()
are widely used for fetching API data and considered as good practice.