/** @format */
import * as React from 'react';
import Router from './router';
import {AliveScope} from 'react-activation';

import {producetAccessReducer} from './service/access';
import ContextStore, {accessInitState} from './service/globalStore';

const App: React.FunctionComponent = () => {
    const [state, dispatch] = React.useReducer(producetAccessReducer, accessInitState);

    return (
        <AliveScope>
            <ContextStore.Provider value={{access: state, dispatch}}>
                <Router />
            </ContextStore.Provider>
        </AliveScope>
    );
};

export default App;
