All quizzesHard
Advanced Composables
Preview — 3 of 10 questions
What is required for a component with an async setup() to work correctly with <Suspense>?
AThe component must be wrapped with defineAsyncComponent
BThe parent must use <Suspense> and the child must export an asyncData function
CThe setup() function must use await at the top level, and the component must be wrapped in <Suspense> in the parent
D<Suspense> only works with useAsyncData from Nuxt, not standalone Vue
How do you handle errors from async setup components within <Suspense>?
AUse try/catch in the parent's setup()
BWrap <Suspense> in a component that implements onErrorCaptured — creating an error boundary
CUse onErrorCaptured hook in the parent wrapping component
DUse the error named slot of <Suspense>
What pattern allows a composable to accept reactive arguments that can be either a plain value or a ref?
AUsing toValue() (Vue 3.3+) or unref() — the MaybeRefOrGetter pattern
BUsing computed to wrap every argument inside the composable
CUsing shallowRef on every argument inside the composable
DUsing TypeScript generics to constrain the argument type at compile time
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.