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

73
Views
Ref/Reactive as store

Is it good idea to use ref or reactive as your store?

what I'm talking about is that I will create some JS file, export ref variable from there , so i can use it anywhere in my code

// counter.store.js
export const counter = ref(0)
// counter.vue

<script setup>
import {counter} from './counter.store.js'
</script>

<template> 

<span> {{ counter }} </span>
<button @click="counter++"> Add </button>

</template>

Is there any downside of this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using Vue reactivity primitives to create simple global store is perfectly fine and it is even described in Vue docs - Simple State Management with Reactivity API

Main drawbacks are:

  1. no support in Vue Dev Tools (so for example looking at the component in Dev Tools you are not able to tell what is components internal state and what comes from the global store)
  2. possible issues in SSR scenarios
  3. suboptimal dev experience - Hot Module Replacement not working
about 4 years ago · Juan Pablo Isaza 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!