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

118
Vistas
vue/composition-api ref only 1 level deep

I know that with ref you have an object/array/primitive reactive, and if it was an object or array it is made deeply reactive.

And with shallowRef you can have only the variable itself reactive but is not made deeply reactive.

In my case I have an array of JSONs where I would like to make reactive the array and the first deep level, because the only actions I am doing is push/slice new items or change the array variable.

So I could use ref([]), but this will make the full JSON reactive which I don't need. And I can not use shallowRef(), because this will work when changing the full json. But won't work with the push/slice actions.

Is there something I am missing? How can I do this approach?

const arr = shallowRef([]);

arr.value.push(JSON); // Not reactive
arr.value.slice(index, 1); //Not reactive
arr.value = [JSON_1, JSON_2]; //reactive
about 4 years ago · Juan Pablo Isaza
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