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

77
Vistas
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 Respuestas
Responde la pregunta

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 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