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

248
Views
Vuex4: no se pueden leer las propiedades de undefined (leyendo 'estado')

Estoy usando Vue3 y Vuex4 , sigo recibiendo el error:

 Uncaught TypeError: Cannot read properties of undefined (reading 'state') at ReactiveEffect.eval [as fn] (App.vue?3dfd:36) at ReactiveEffect.run (reactivity.esm-bundler.js?a1e9:160) at ComputedRefImpl.get value [as value] (reactivity.esm-bundler.js?a1e9:1087) at setup (App.vue?3dfd:37) at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:6656) at setupStatefulComponent (runtime-core.esm-bundler.js?5c40:6272) at setupComponent (runtime-core.esm-bundler.js?5c40:6228) at mountComponent (runtime-core.esm-bundler.js?5c40:4081) at processComponent (runtime-core.esm-bundler.js?5c40:4056) at patch (runtime-core.esm-bundler.js?5c40:3651)

Estoy tratando de configurar el "hola" en la variable del mensaje para poder usarlo en toda mi aplicación. Este es mi archivo main.js :

 import { createApp} from 'vue' import App from './App.vue' import router from './router' import { createStore } from 'vuex'; const store = createStore({ state(){ return{ message: 'hello' } } }) createApp(App).use(router, store).mount('#app')

Este es mi archivo App.vue, estoy tratando de recibirlo con la API de composición usando la función calculada.

 import { ref, computed } from 'vue' import { useStore } from 'vuex' export default { name: 'App', setup(){ const store = useStore(); const message = computed(() => store.state.message); console.log(message.value); return{ } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba con:

 createApp(App) .use(router) .use(store) .mount('#app')
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!