-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreduxIndex.tsx
More file actions
36 lines (30 loc) · 972 Bytes
/
Copy pathreduxIndex.tsx
File metadata and controls
36 lines (30 loc) · 972 Bytes
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.ts';
import TopGeorgist from './ui/topGeorgist.react.tsx';
import init from './topGeorgist.ts';
import * as viewsActions from './actions/views.ts';
import * as defaultsActions from './actions/defaults.ts';
import { type TgoId } from './reducers/tgo.ts';
import { type ViewId } from './reducers/view.ts';
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'),
);