Vue Lifecycle Hooks are an example of the Template Method Design Pattern.
In the case of SSR, only the creation hooks are run on the server-side, all other hooks are run client-side.
Vue has an
errorCaptured()
hook and contrary to what you might believe, it does not capture all the errors thrown inside the component. Setting up a global error handler is suggested.You can do programmatic lifecycle hook registration using
$on
or$once
and pre-pending the hook name withhook:
. Similarly, you can also listen to lifecycle hooks from children components.There is a significant delay between the
created()
and themounted()
hook.
I cover all the above-mentioned points and more in my talk here.
Happy Coding!
Top comments (0)