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

287
Views
Vue 3 - can i avoid using .value everywhere?

I'm quite new to Vue 3 and i'm struggling a lot to understand some concepts of the composition API. I'm trying to port a library i'm using from vue 2 to vue 3, and in a parent element a reactive property called layout is passed to children components.

So in the parent component i'm returning layout to the children like this:

setup(props){
    const layout = ref({'width': 10, ... })
    return {
        layout,
        ...
    }
}

The problem is that, in order to access width or any other reactive value in layout from any children component i need to use the syntax layout.value.width. This is quite a problem because through the whole project layout is referenced with layout.width, this means that i need to add a .value to every reference to layout and do the same for all the other reactive variables i'm passing to my children components. Is there any way to avoid this or am i just not getting some important concepts from the composition api?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There are at least two ways:

  1. Yes. You can work without the .value. You have to use the vue experimental version

or

  1. You can create a reactive variable, like:
<script setup>
import { reactive } from 'vue'

const layout = reactive({'width': 10, ... })
</script>
about 4 years ago · Santiago Trujillo 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!