)}
{/* GLOBAL LOADING OVERLAY (Optional, for heavy API calls) */}
{isLoading && (
)}
);
};
// 3. Custom Hook untuk mempermudah pemakaian
const useApp = () => {
const context = useContext(AppContext);
if (!context) {
throw new Error("useApp must be used within an AppProvider");
}
return context;
};
// Expose ke Global Scope agar bisa diakses file lain tanpa import/require
window.AppProvider = AppProvider;
window.useApp = useApp;