-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
70 lines (60 loc) · 1.67 KB
/
app.js
File metadata and controls
70 lines (60 loc) · 1.67 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* External dependencies
*/
import React from 'react';
import { render } from 'react-dom';
import { createStore, combineReducers, compose, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { createBrowserHistory } from 'history';
import { connectRouter, ConnectedRouter, routerMiddleware } from 'connected-react-router'
import thunk from 'redux-thunk';
import { persistStore, persistCombineReducers } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { HashRouter, Route } from 'react-router-dom';
/**
* Internal dependencies
*/
import reducers from './reducers';
import Stylizer, { insertCss } from './lib/stylizer';
import Root from './containers/root';
const config = {
key: 'primary',
storage,
blacklist: [ 'data' ],
}
const history = createBrowserHistory()
let reducer = persistCombineReducers(config, reducers);
const store = createStore(
connectRouter( history )( reducer ),
window.devToolsExtension ? window.devToolsExtension() : f => f,
compose(
applyMiddleware( routerMiddleware( history ), thunk )
)
);
persistStore( store );
const routes = {
path: '/',
slug: 'root',
component: Root,
};
//document.getElementById( 'reference' ).style.display = 'none';
class App extends React.Component{
constructor(props) {
super(props);
this.state = {
highlightedWord: ''
};
}
render() {
return (
<Provider store={ store }>
<ConnectedRouter history={ history }>
<Stylizer onInsertCss={ insertCss }>
<HashRouter><Route path="/" render={ () => <Root highlightedWord={ this.state.highlightedWord } /> } /></HashRouter>
</Stylizer>
</ConnectedRouter>
</Provider>
);
}
}
export default App;