import React , { createContext , useContext } from 'react' ; export interface Context { isCloudEnabled : boolean ; cloudBaseUrl : string ; } export const AppContext = createContext < Context > ( { } as any ) ; export const AppContextProvider = ( { children , context , } ) => { return < AppContext . Provider value = { context } > { children } < /AppContext.Provider>; } ; export const useAppContext = ( ) => { const ctx = useContext ( AppContext ) ; if ( ! ctx ) throw new Error ( 'Cannot use outside of app context' ) ; return ctx ; } ;