Skip to content

Error rendering component with <component :is="" /> #10021

Discussion options

You must be logged in to vote

I assume you receive a string 'ModalToggle'?

What you meed is an actual reference to the component object, though.

Since there is no component registration in script setup> (like there is with defineComponent()), Vue can't determine what that string should be mapped to.

So you need to provide that yourself

const components = {
  ModalToggle: ModalToggle
}
<component :is="components[state.component]">

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pedrodruviaro
Comment options

Answer selected by pedrodruviaro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants