@macalinao/grill
Version:
Modern Solana development kit for React applications with automatic account batching, caching, and transaction notifications
21 lines • 764 B
JavaScript
import { createContext, useContext } from "react";
/**
* React context for Solana account provider functionality.
* Provides access to batch account loading capabilities throughout the component tree.
*/
export const GrillContext = createContext(null);
/**
* Hook to access the SolanaAccount context.
* Must be used within a SolanaAccountProvider component tree.
*
* @returns The SolanaAccount context value containing the account loader
* @throws Error if used outside of a SolanaAccountProvider
*/
export const useGrillContext = () => {
const context = useContext(GrillContext);
if (!context) {
throw new Error("useGrillContext must be used within a GrillProvider");
}
return context;
};
//# sourceMappingURL=grill-context.js.map