11 lines
372 B
TypeScript
11 lines
372 B
TypeScript
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;
|
|
} |