UNPKG

@sigi/react

Version:

React bindings for sigi framework

24 lines 1.06 kB
import { useServerInstance } from './injectable-context'; var SERVER_DISPATCHERS = new Proxy(Object.create(null), { apply: function () { if (process.env.NODE_ENV !== 'production') { console.warn(new Error('Dispatch while calling react-dom/server functions is forbidden')); } }, }); export function useDispatchers(_A) { return SERVER_DISPATCHERS; } export function useModuleState(A, config) { var store = useServerInstance(A).store; return typeof (config === null || config === void 0 ? void 0 : config.selector) === 'function' ? config.selector(store.state) : store.state; } export function useModule(A, config) { var effectModule = useServerInstance(A); var store = effectModule.store; var appState = typeof (config === null || config === void 0 ? void 0 : config.selector) === 'function' ? config.selector(store.state) : store.state; return [appState, SERVER_DISPATCHERS]; } export { SSRContext } from './ssr-context'; export * from './injectable-context'; //# sourceMappingURL=index.js.map