search

Home  >  Q&A  >  body text

What does vuex store.watch() mean

This code appears in a vuex project:

store.watch(
    (state) => state.sessions,
    (val) => {
        console.log('CHANGE: ', val);
        localStorage.setItem('vue-chat-session', JSON.stringify(val));
        localStorage.setItem('islogin', JSON.stringify(val));
    }, {
        deep: true
    }
);

What does the code mean? Does Vuex also have watches?

ringa_leeringa_lee2717 days ago1248

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-07-05 11:07:21

    reply
    0
  • Cancelreply