forked from algorithm-visualizer/algorithm-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
40 lines (36 loc) · 1.2 KB
/
index.jsx
File metadata and controls
40 lines (36 loc) · 1.2 KB
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
37
38
39
40
import React from 'react';
import ReactDOM from 'react-dom';
import { combineReducers, createStore } from 'redux';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { routerReducer } from 'react-router-redux';
import App from '/components/App';
import * as reducers from '/reducers';
const MOUNT_NODE = document.getElementById('root');
const store = createStore(combineReducers({ ...reducers, routing: routerReducer }));
const render = (Component) => {
ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<Switch>
<Route exact path="/scratch-paper/:gistId" component={Component} />
<Route exact path="/:categoryKey/:algorithmKey" component={Component} />
<Route path="/" component={Component} />
</Switch>
</BrowserRouter>
</Provider>,
MOUNT_NODE
);
};
render(App);
if (module.hot) {
module.hot.accept('./components/App/index.jsx', () => {
const NextApp = require('/components/App').default;
try {
render(NextApp);
} catch (error) {
const RedBox = require('redbox-react').default;
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE);
}
});
}