Skip to main content

Store

Qore uses small Zustand stores for frontend state.

Read shared application metadata from the Qore stores. Create app-specific stores only for state that belongs to your application and is not already part of auth, layout or globals.

The system stores are exported from qore-next:

  • auth: authenticated user state.
  • layout: layout state.
  • globals: menu, resources, modules, preferences, feature flags and unread notification count.

Globals store

useGlobalStore is populated from the backend globals response and persisted under globals-storage.

import { useGlobalStore } from 'qore-next'

const resources = useGlobalStore((state) => state.resources)
const isNotificationsEnabled = useGlobalStore((state) => state.isNotificationsEnabled)

It exists so layout components can share app-wide data without prop drilling.

Application state

Add application-specific stores in resources/js. Keep them outside the framework unless the state is useful to every Qore app.