Look at the Nuxt 3 documentation to learn more.
Make sure to install the dependencies:
# yarn
yarn install
# npm
npm install
# pnpm
pnpm install --shamefully-hoistCheck out the deployment documentation for more information.
For simple data is possible to use native nuxt state management (useState). Otherwise, for complex data, is better to use Pinia
export const useGlobals = () => {
const globals = useState("globals", () => {})
const setGlobals = (data) => {
globals.value = data
}
return {
globals,
setGlobals,
}
}
export const useGlobals = () => useState("testGlobals")
const testGlobals = useGlobals()
testGlobals.value = { ... }
export const useStore = defineStore("store", () => {
return {}
})