From the Composition API docs on Lifecycle Hooks:
Because
setup
is run around thebeforeCreate
andcreated
lifecycle hooks, you do not need to explicitly define them. In other words, any code that would be written inside those hooks should be written directly in thesetup
function.
Anything you would have done in the created
hook you can do in setup
.