github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/public/src/overmind/index.tsx (about) 1 import { createStateHook, createActionsHook, createEffectsHook } from 'overmind-react' 2 import { state } from './state' 3 import * as actions from './actions' 4 import * as effects from './effects' 5 import * as review from './namespaces/review' 6 import { IContext } from 'overmind' 7 import { merge, namespaced } from 'overmind/config'; 8 9 /* This is the main overmind configuration. */ 10 11 /* To add a new namespace, add it to the namespaced object. */ 12 export const config = merge( 13 { 14 state, 15 actions, 16 effects, 17 }, 18 namespaced({ 19 review 20 }) 21 ) 22 23 24 export type Context = IContext<{ 25 state: typeof config.state; 26 actions: typeof config.actions; 27 effects: typeof config.effects; 28 }>; 29 30 /* These are the overmind state hooks, which are used in components to access and modify the state. */ 31 export const useAppState = createStateHook<Context>() 32 export const useActions = createActionsHook<Context>() 33 export const useGrpc = createEffectsHook<Context>()