render.js 1.4 KB
Newer Older
1 2 3 4
import React from 'react';
import ReactDOM from 'react-dom';
import { history } from '@wisdom-utils/runtime';
import { Provider } from 'react-redux';
5
import { ConfigProvider, message, Modal, notification } from 'antd';
6
import { ConnectedRouter } from 'connected-react-router/immutable';
7
import { ErrorBoundary, LocaleContainer } from '@wisdom-utils/components';
邓晓峰's avatar
邓晓峰 committed
8
import store from './stores';
9 10 11
import Container from './components/Container';
import App from './containers/App';
const MOUNT_NODE = document.getElementById('root');
12 13 14 15 16 17 18 19 20 21 22 23 24 25
const customPrefixCls = 'panda-console-base';
Modal.config({
  rootPrefixCls: customPrefixCls
});
message.config({
  rootPrefixCls: customPrefixCls
});
notification.config({
  rootPrefixCls: customPrefixCls
});
ConfigProvider.config({
  prefixCls: customPrefixCls,
});

26
export const render = () => {
邓晓峰's avatar
邓晓峰 committed
27 28 29 30 31
  // eslint-disable-next-line react-hooks/rules-of-hooks
  ReactDOM.render(
    <Provider store={store}>
      <ConnectedRouter history={history}>
        <LocaleContainer>
32
          <ConfigProvider prefixCls={customPrefixCls}>
邓晓峰's avatar
邓晓峰 committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46
            <ErrorBoundary>
              <Container>
                <App />
              </Container>
            </ErrorBoundary>
          </ConfigProvider>
        </LocaleContainer>
      </ConnectedRouter>
    </Provider>,
    MOUNT_NODE,
  );
};
// updateTheme('#ff9600');
const loader = (appContent, loading) => render({ appContent, loading });
47

邓晓峰's avatar
邓晓峰 committed
48
export default loader;