Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

374
Visualizações
Can I define a Vue JSX component within a SFC <script setup> and use it in the SFC template?

I like that in React you can quickly create small components within the main component file. Is something like that possible with Vue 3 composition API?

Something like this:

Component.vue

<script setup>
    const SmallComponent = <div>Test</div>
</script>
<template>
    <SmallComponent/>
</template>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The problem here is that SmallComponent is not a component but vnode object. Vnodes can be directly rendered in render functions but not templates.

Instead, it should be functional component:

const SmallComponent = props => <div>Test</div>

In script setup, it's the only available option, because the syntax provides a subset of functionality and doesn't support render functions.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda