Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

372
Vistas
Vue 3 - how to return html from function?

I'm trying to use render functions with vue 3, and for some reasons i can't return my JSX directly in return () => [], but i need to return it from inside a function, and i was wondering if that's possible.

Here is what i'm trying to do:

const testreturn = () => {
    return h('div', { id: 'foo', innerHTML: 'hello world' }, [])
}

return () => [
    testreturn
]

If i try this, instead of seeing 'hello world' in my template, i will see the function testreturn printed out to the screen.

Instead if i try this:

return () => [
    h('div', { id: 'foo', innerHTML: 'hello world' }, [])
]

I will see a div in my template. Is there any way to accomplish what i'm trying to do in the first case?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Wouldn't it be enough to just call the function like that?

return () => [
    testreturn()
]

This is in the end the same thing as when you include the h(...) directly in the return array. Vue won't execute a function when using it inside the template.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda