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

166
Vistas
Use watch in onMounted hook or setup vuejs 3

Is it better to use watch in onMounted hook or Setup (created hook) in vue compositionApi? Using watch in setup is a bad practice? And if not which one is better at all?

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

0

It always depends on what you want to do.

created() :

  • you have access to the reactive data,
  • but no DOM manipulation possible,

mounted()

  • manipulation of the DOM possible

The created function is generally used for fetching data (maybe) from the API and assign it to data. So if, as in your case, it is only a matter of setup data such as api themes, setup would be preferable.

And if this is not the case and you need / want to use the mounted() function, then you might want to consider whether computed might be the right choice.

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