@renegade-fi/react
Version:
React library for Renegade
20 lines (13 loc) • 447 B
text/typescript
"use client";
import { createContext, useContext } from "react";
type WasmContextValue = {
isInitialized: boolean;
};
export const WasmContext = createContext<WasmContextValue | undefined>(undefined);
export function useWasmInitialized() {
const context = useContext(WasmContext);
if (!context) {
throw new Error("useWasmInitialized must be used within a <RenegadeProvider />");
}
return context.isInitialized;
}