|
@@ -1,19 +1,16 @@
|
|
|
-import React, { Reducer, useCallback, useReducer, useState } from 'react';
|
|
|
|
|
|
|
+import React, { useCallback, useState } from 'react';
|
|
|
|
|
+import { useReducer } from 'reinspect';
|
|
|
|
|
|
|
|
-import { AnyAction, nameSet } from '../actions';
|
|
|
|
|
|
|
+import { nameSet } from '../actions';
|
|
|
import { DispatchContext, StateContext } from '../context/state';
|
|
import { DispatchContext, StateContext } from '../context/state';
|
|
|
import { useDispatchWithEffects, useOnMessage, useSocket } from '../hooks/socket';
|
|
import { useDispatchWithEffects, useOnMessage, useSocket } from '../hooks/socket';
|
|
|
-import { globalReducer, GlobalState, initialState } from '../reducer';
|
|
|
|
|
|
|
+import { globalReducer, initialState } from '../reducer';
|
|
|
import { init } from '../utils/state';
|
|
import { init } from '../utils/state';
|
|
|
import { App } from './app';
|
|
import { App } from './app';
|
|
|
import { Identify } from './identify';
|
|
import { Identify } from './identify';
|
|
|
|
|
|
|
|
export const Root: React.FC = () => {
|
|
export const Root: React.FC = () => {
|
|
|
- const [state, dispatch] = useReducer<Reducer<GlobalState, AnyAction>, GlobalState>(
|
|
|
|
|
- globalReducer,
|
|
|
|
|
- initialState,
|
|
|
|
|
- init,
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ const [state, dispatch] = useReducer(globalReducer, initialState, init, 'global');
|
|
|
|
|
|
|
|
const onMessage = useOnMessage(dispatch);
|
|
const onMessage = useOnMessage(dispatch);
|
|
|
|
|
|