Nuxt useState

up:: Nuxt ⚐

A replacement for Vue Refs reactive that allows state to be shared across all components.

useState

Makes state management easier than Pina or Vuex apparently. The Ref is built into Nuxt.

const progress = useState(
	'progress' // unique key
	  , () => { // function that returns default value
	return []; 
})

Shared state

By creating a state in Nuxt Composables, it can be imported across all components.

composables/states.ts

export const useCounter = () => useState('counter', () => 0)