Vue 'created' Lifecycle Hook


Example

Using the created lifecycle hook to change the 'text' data property.

export default {
  data() {
    return {
      text: 'initial text'
    }
  },
  created() {
    this.text = 'The component is now created';
  }
}
Run Example »

Definition and Usage

The created lifecycle hook is called after the component is initialized.

Because the component is initialized, we can access properties inside the component instance such as data or computed, but we cannot access component DOM elements because they are not created until the mounted hook.


Related Pages

Vue Tutorial: Vue Lifecycle Hooks

Vue Tutorial: The 'created' Hook

Vue Reference: Vue 'beforeCreate' Lifecycle Hook

Vue Reference: Vue 'mounted' Lifecycle Hook


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.