-
Notifications
You must be signed in to change notification settings - Fork 0
/
reduxIndex.tsx
36 lines (30 loc) · 961 Bytes
/
reduxIndex.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { useEffect, useState } from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { store } from './storeClient.js';
import TopGeorgist from './ui/topGeorgist.react.js';
import init from './topGeorgist.js';
import * as viewsActions from './actions/views.js';
import * as defaultsActions from './actions/defaults.js';
import { TgoId } from './reducers/tgo.js';
import { ViewId } from './reducers/view.js';
const Providers = () => {
const [ initialized, setInitialized ] = useState(false);
useEffect(() => {
init();
const mainViewAction = store.dispatch(viewsActions.create('main' as ViewId, 'jesh' as TgoId));
store.dispatch(defaultsActions.setViewId(mainViewAction.payload.view.viewId));
setInitialized(true);
}, [])
if (!initialized)
return (null);
return (
<Provider store={store}>
<TopGeorgist />
</Provider>
);
};
render(
<Providers />,
document.getElementById('root'),
);