5

I have been working with vue3-beta release, I just found out that there is a defineAsyncComponent in the new library. I haven't found anything about that on the internet.

Just wanted to know what is its use-case and when to use it. how is it different from the async setup() feature. and what would be the performance comparison between two.

1 Answer 1

4

It's used to lazy-load a component (and optionally display a place-holder when loading or failing). It exists in Vue2 already but it's not a specific function. Did you read https://github.com/vuejs/rfcs/blob/master/active-rfcs/0026-async-component-api.md ?

Sign up to request clarification or add additional context in comments.

1 Comment

why when I use it I get the following error? [Vue Router warn]: Component "default" in record with path "/admin/new-post" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.