Error rendering component with <component :is="" /> #10021
-
I am unable to render the modal component correctly. In the payload of the handleModalToggle function, I am receiving the correct value "ModalLogin," but the component does not render based on it. The composition API without setup is being used in the coutrse example, and everything works. The issue arises only when using setup.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I assume you receive a string What you meed is an actual reference to the component object, though. Since there is no component registration in So you need to provide that yourself const components = {
ModalToggle: ModalToggle
} <component :is="components[state.component]"> |
Beta Was this translation helpful? Give feedback.
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 withdefineComponent()
), Vue can't determine what that string should be mapped to.So you need to provide that yourself