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

115
Views
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
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!