How to make an async call in a beforeCreate hook of a Vue instance? How to make an async call in a beforeCreate hook of a Vue instance? vue.js vue.js

How to make an async call in a beforeCreate hook of a Vue instance?


The current lifecycle callbacks are functions without any promises/async behaviour. Unfortunately, there does not appear to be a way to cause the app to "pause" while you load data. Instead, you might want to start the load in the beforeCreate function and set a flag, display a loading screen/skeleton with empty data, flip the flag when the data has loaded, and then render the appropriate component.