Files
SCM-Manager/scm-ui/src/index.js

50 lines
1.4 KiB
JavaScript
Raw Normal View History

// @flow
import React from "react";
import ReactDOM from "react-dom";
import App from "./containers/App";
import registerServiceWorker from "./registerServiceWorker";
2018-07-02 14:50:13 +02:00
import { I18nextProvider } from "react-i18next";
import i18n from "./i18n";
import { Provider } from "react-redux";
import createHistory from "history/createBrowserHistory";
2018-07-02 14:50:13 +02:00
import type { BrowserHistory } from "history/createBrowserHistory";
import createReduxStore from "./createReduxStore";
import { ConnectedRouter } from "react-router-redux";
2018-08-24 12:43:10 +02:00
import PluginLoader from "./components/PluginLoader";
const publicUrl: string = process.env.PUBLIC_URL || "";
2018-07-02 14:50:13 +02:00
// Create a history of your choosing (we're using a browser history in this case)
const history: BrowserHistory = createHistory({
basename: publicUrl
2018-07-02 14:50:13 +02:00
});
// Add the reducer to your store on the `router` key
// Also apply our middleware for navigating
const store = createReduxStore(history);
const root = document.getElementById("root");
if (!root) {
throw new Error("could not find root element");
}
2018-07-02 14:50:13 +02:00
ReactDOM.render(
<Provider store={store}>
<I18nextProvider i18n={i18n}>
{/* ConnectedRouter will use the store from Provider automatically */}
<ConnectedRouter history={history}>
2018-08-24 12:43:10 +02:00
<PluginLoader>
<App />
</PluginLoader>
</ConnectedRouter>
</I18nextProvider>
2018-07-02 14:50:13 +02:00
</Provider>,
root
2018-07-02 14:50:13 +02:00
);
registerServiceWorker();