K
K
kuzubina2021-02-23 00:59:07
Vue.js
kuzubina, 2021-02-23 00:59:07

How to change an array from Vuex from a variable and put it back?

Plz tell me, i'm facing the same problem. There is an array in the vuex storage, which I get in the component through a getter (everything is as it should be) and save it to a variable, then when in the function I start working with a new variable and change the order of the objects in this array (so that I can then put the changed array) then I immediately get an error in the console
Error: [vuex] do not mutate vuex store state outside mutation handlers.
How can I change this array correctly? so that there are no errors?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2021-02-23
@yarkov Vue.js

Translate error text and don't do so

A
Alexander, 2021-02-23
@Aleksandr-JS-Developer

You need to read about mutations and actions. Everything will become clear right away.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question