import { useContext } from "react"; import { AccountContext, AccountContextValue } from "./AccountProvider"; export function useAccountProvider() : AccountContextValue { const context : AccountContextValue = useContext(AccountContext); if(!context){ throw new Error("useAccountProvider must be used within a AccountProvider"); } return context; }