import { IContext, IElementState } from "../types"; export const useContextHook = (state: IElementState, context: IContext) => { const exists = state.contexts.find((item) => item.context === context); if (!exists) { throw new Error("Not found context " + context); } return exists.value; };