Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

375
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!