Posts about Vuex

This in Vuex class modules

July 23rd 2021 Vuex

Vuex module decorators allow Vuex module code to be written in the form of a class, rather than in a structured object that follows a specific convention. However, the abstraction is incomplete and even in the class you must follow some conventions or your code will break at runtime.

Waiting for Vuex actions in Nuxt layouts

July 16th 2021 Vuex NuxtJS

Thanks to Vue's reactivity, it usually does not matter where and when Vuex state is initialized. State can be exposed in components as computed properties, and the page is automatically updated when their values change. However, if a value from the state is used programmatically on the page, Vue reactivity cannot be relied upon to trigger that code when the Vuex state is initialized and the value is ready.

Vuex-module-decorators actions are async

June 11th 2021 Vuex

The vuex-module-decorators package makes it easy to create a strongly typed Vuex store for use with TypeScript. However, there are some pitfalls in handling errors in actions.

Strongly-typed Vuex Store in NuxtJS

July 31st 2020 Vuex TypeScript NuxtJS

Vuex store code can be quite verbose, especially with wrappers for type-safety in TypeScript. A lot of that plumbing can be avoided with the vuex-module-decoorators package. There's some extra configuration required to get it working in NuxtJS.

Vuex Modules in Multiple Files in NuxtJS

July 3rd 2020 NuxtJS Vuex Vue.js

One of the options for creating a Vuex module in NuxtJS is to create separate state.ts, getters.ts, mutations.ts, and actions.ts files in the module folder. Especially for large modules, this can make the code easier to navigate. However, a very important detail about this approach is mentioned very briefly in the documentation.