mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-10 22:18:03 -05:00
20 lines
478 B
TypeScript
20 lines
478 B
TypeScript
import React from 'react';
|
|
import { useInterpret } from '@xstate/react';
|
|
import { appMachine, logState } from '../machines/app';
|
|
|
|
import { GlobalContext } from '../shared/GlobalContext';
|
|
|
|
export const GlobalContextProvider: React.FC = (props) => {
|
|
const appService = useInterpret(appMachine);
|
|
|
|
if (__DEV__) {
|
|
appService.subscribe(logState);
|
|
}
|
|
|
|
return (
|
|
<GlobalContext.Provider value={{ appService }}>
|
|
{props.children}
|
|
</GlobalContext.Provider>
|
|
);
|
|
};
|