-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.tsx
33 lines (28 loc) · 1.17 KB
/
index.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
import React, {Suspense} from 'react';
import {Provider as ReduxProvider} from 'react-redux';
import store, {reduxMiddlewareManager, rrfProps} from './store/store';
import App from './App';
import {DemoLazyLoading} from './components';
import {ReactReduxFirebaseProvider} from 'react-redux-firebase';
import './hacks/long-period-timer';
import createSagaMiddleware from 'redux-saga';
import {sagasGenerator} from './store/sagas';
import thunkMiddleware from 'redux-thunk';
export const sagaMiddleware = createSagaMiddleware();
// you might choose one redux middleware which you prefer,
// just delete the demos you not prefer,or just use them all
reduxMiddlewareManager.addMiddleware(sagaMiddleware);
reduxMiddlewareManager.addMiddleware(thunkMiddleware);
sagaMiddleware.run(sagasGenerator);
export default function index() {
const renderInner = () => <ReduxProvider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<App/>
</ReactReduxFirebaseProvider>
</ReduxProvider>;
// SSR does not support Suspense
const suspenseWrapped = () => <Suspense fallback={<DemoLazyLoading/>}>
{renderInner()}
</Suspense>;
return renderInner();
}