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

42 lines
1.1 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 { 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";
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}>
{/* ConnectedRouter will use the store from Provider automatically */}
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
2018-07-02 14:50:13 +02:00
</Provider>,
root
2018-07-02 14:50:13 +02:00
);
registerServiceWorker();