Why Pinia vs Vuex for Vue 3? [closed]

In short, Pinia’s API is much simpler and intuitive. It makes using stores a breeze, even for junior devs. It brings the benefits of Composition API, but has a structure which greatly resembles the Options API, which you’re probably familiar with: has a reactive state, equivalent of data function in Options API has getters, equivalent … Read more

[Vue warn]: Unknown custom element: – When running jest unit tests

This is how I was able to get rid of the annoying warning: Include RouterLinkStub, eg.: import { shallowMount, createLocalVue, RouterLinkStub } from ‘@vue/test-utils’; Map NuxtLink stub to RouterLinkStub const wrapper = shallowMount(TestItem, { … stubs: { NuxtLink: RouterLinkStub } }) And in case you were checking nuxt-link text or something, change: const link = … Read more

How to call function from watch?

If you want to use watch to observe your property, you could call your method it with this.foo: data: function () { return { questions: [] } }, watch: { questions: { handler: function(val, oldVal) { this.foo(); // call it in the context of your component object }, deep: true } }, methods: { foo() … Read more

tech