UNPKG

keep-vue

Version:

Keep Vue is an open-source component library built on top of Vue3 and Tailwind CSS. It offers a collection of pre-designed UI components and styles that you can easily integrate into your web applications.

17 lines (16 loc) 486 B
import { createInjectionState } from "@vueuse/core"; import {} from "vue"; const AlertStoreKey = "alert-store"; const [useProvideAlert, useInjectAlert] = createInjectionState((color) => { return { color }; }, { injectionKey: AlertStoreKey, }); function useAlert() { const alertState = useInjectAlert(); if (!alertState) { throw new Error("useAlert must be used within a <Alert /> Component"); } return alertState; } export { useAlert, useProvideAlert };