I want to run a event before content load. I do it on Vue 3 option API wiht created() lifecycle hook but Now, I do it with Vue 3 Composition API.
Code:
<script setup>
import { created } from "vue";
const initDark = created(() => {
console.log("init");
});
</script>
When I use it then show a console error.
How can i solve this.
I try below code but it didn't work as expected and it generate a console error.
<script setup>
import { created } from "vue";
const initDark = created(() => {
console.log("init");
});
</script>

No, Vue3 Composition API does not include a lifecycle method named
created. This is becausecreatedhas been replaced withsetup.You can write
console.log("init");at the top-level.tip: if you want to include a lifecycle hook like
mounted, importonMountedinstead ofmounted: