import { PropsWithChildren, createContext, useContext, useMemo } from "react"; import { Ark } from "./ark"; export const ArkContext = createContext(undefined); export const ArkProvider = ({ children }: PropsWithChildren) => { const ark = useMemo(() => new Ark(), []); return {children}; }; export const useArk = () => { const context = useContext(ArkContext); if (context === undefined) { throw new Error("Ark Provider is not import"); } return context; };