// https://vike.dev/useData export { useData } export { setData } import { inject } from 'vue' import type { App, InjectionKey, Ref } from 'vue' const key: InjectionKey> = Symbol() /** https://vike.dev/useData */ function useData(): Ref { const data = inject(key) if (!data) throw new Error('setData() not called') return data as Ref } function setData(app: App, data: Ref): void { app.provide(key, data) }