[Vuejs]-Can I have two seperate state functions?

0👍

Not sure if that’s what you mean. But this might do the the trick:

state: initialState(),
stateHistory:[initialState()]

And then you can do this before resetting

stateHistory.push(JSON.parse(JSON.stringify(state))) // creates a deepy copy of your current state
resetState() // reset the state after storing old state

Leave a comment