A
A
Ankozar2021-08-24 18:06:59
Vue.js
Ankozar, 2021-08-24 18:06:59

Is it possible to track store.state in vuex?

It seems there is also a watch there, but I don’t understand the syntax. Docks looked - it is not clear, help, please.

It is necessary that when state.foo changes, the vuex method is run.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2021-08-24
@yarkov Vue.js

Docks looked - it's not clear

Xs where did you look, and I googled it on the first try.
store.watch((state) => state.searchString, (oldValue, newValue) => {
    console.log('search string is changing')
    console.log(oldValue)
    console.log(newValue)
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question