parent
fa178148e6
commit
cba2296e4a
@ -1,13 +1,28 @@ |
||||
import React from 'react' |
||||
import {ThemeType} from './types' |
||||
import {CompilationResult} from '@remixproject/plugin-api' |
||||
|
||||
export const AppContext = React.createContext({ |
||||
themeType: 'dark' as ThemeType, |
||||
// Define the type for the context
|
||||
type AppContextType = { |
||||
themeType: ThemeType |
||||
setThemeType: (themeType: ThemeType) => void |
||||
chains: any[] |
||||
selectedChain: any | undefined |
||||
setSelectedChain: (chain: string) => void |
||||
compilationOutput: CompilationResult | undefined |
||||
} |
||||
|
||||
// Provide a default value with the appropriate types
|
||||
const defaultContextValue: AppContextType = { |
||||
themeType: 'dark', |
||||
setThemeType: (themeType: ThemeType) => { |
||||
console.log('Calling Set Theme Type') |
||||
}, |
||||
chains: [], |
||||
selectedChain: null, |
||||
selectedChain: undefined, |
||||
setSelectedChain: (chain: string) => {}, |
||||
contractNames: [], |
||||
}) |
||||
compilationOutput: undefined, |
||||
} |
||||
|
||||
// Create the context with the type
|
||||
export const AppContext = React.createContext<AppContextType>(defaultContextValue) |
||||
|
Loading…
Reference in new issue