Exercise 7 | 20 mins

<aside> 💡 Hint: useRefHistory from VueUse could be very helpful in this. Don’t forget to install VueUse:

npm i @vueuse/core

</aside>

<aside> 💡 Hint: The useRefHistory already returns the functions you need.

const state = ref({})
const { undo, redo } = useRefHistory(state, { deep: true })

Simply make those functions available in the stores that use the plugin.

</aside>

This is a tough one, feel free to ask for help! :)

✅ When complete you should be able to create undo redo buttons that trigger the undo and redo actions on the CartStore like this:

undo-redo-pinia.gif