This repository was archived by the owner on Sep 11, 2018. It is now read-only.
File tree Expand file treeCollapse file tree 4 files changed+20
-13
lines changedFilter options
+20
-13
lines changed Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@
60
60
"better-npm-run": "0.0.5",
61
61
"co-request": "^1.0.0",
62
62
"debug": "^2.2.0",
63
-
"history": "^2.0.0-rc2",
63
+
"history": "^2.0.0",
64
64
"iconv-lite": "^0.4.13",
65
65
"koa": "^2.0.0-alpha.3",
66
66
"koa-connect-history-api-fallback": "^0.3.0",
@@ -70,7 +70,7 @@
70
70
"react-dom": "^0.14.0",
71
71
"react-redux": "^4.0.0",
72
72
"react-router": "^2.0.0",
73
-
"react-router-redux": "^3.0.0",
73
+
"react-router-redux": "^4.0.0-beta",
74
74
"redux": "^3.0.0",
75
75
"redux-thunk": "^1.0.0",
76
76
"url": "^0.11.0",
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
1
1
import React from 'react'
2
2
import ReactDOM from 'react-dom'
3
3
import { browserHistory } from 'react-router'
4
+
import { syncHistoryWithStore } from 'react-router-redux'
4
5
import makeRoutes from './routes'
5
6
import Root from './containers/Root'
6
7
import configureStore from './redux/configureStore'
7
8
9
+
// Create redux store and sync with react-router-redux. We have installed the
10
+
// react-router-redux reducer under the key "router" in src/routes/index.js,
11
+
// so we need to provide a custom `selectLocationState` to inform
12
+
// react-router-redux of its location.
8
13
const initialState = window.__INITIAL_STATE__
9
-
const store = configureStore({ initialState, history })
14
+
const store = configureStore(initialState)
15
+
const history = syncHistoryWithStore(browserHistory, store, {
16
+
selectLocationState: (state) => state.router
17
+
})
10
18
19
+
// Now that we have the Redux store, we can create our routes. We provide
20
+
// the store to the route definitions so that routes have access to it for
21
+
// hooks such as `onEnter`.
11
22
const routes = makeRoutes(store)
12
23
13
-
// Render the React application to the DOM
24
+
// Now that redux and react-router have been configured, we can render the
25
+
// React application to the DOM!
14
26
ReactDOM.render(
15
-
<Root history={browserHistory} routes={routes} store={store} />,
27
+
<Root history={history} routes={routes} store={store} />,
16
28
document.getElementById('root')
17
29
)
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
1
1
import { applyMiddleware, compose, createStore } from 'redux'
2
-
import { syncHistory } from 'react-router-redux'
3
2
import thunk from 'redux-thunk'
4
3
import rootReducer from './rootReducer'
5
4
6
-
export default function configureStore ({ initialState = {}, history }) {
7
-
// Sync with router via history instance (main.js)
8
-
const routerMiddleware = syncHistory(history)
9
-
5
+
export default function configureStore (initialState = {}) {
10
6
// Compose final middleware and use devtools in debug environment
11
-
let middleware = applyMiddleware(thunk, routerMiddleware)
7
+
let middleware = applyMiddleware(thunk)
12
8
if (__DEBUG__) {
13
9
const devTools = window.devToolsExtension
14
10
? window.devToolsExtension()
@@ -18,7 +14,6 @@ export default function configureStore ({ initialState = {}, history }) {
18
14
19
15
// Create final store and subscribe router in debug env ie. for devtools
20
16
const store = middleware(createStore)(rootReducer, initialState)
21
-
if (__DEBUG__) routerMiddleware.listenForReplays(store, ({ router }) => router.location)
22
17
23
18
if (module.hot) {
24
19
module.hot.accept('./rootReducer', () => {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1
1
import { combineReducers } from 'redux'
2
-
import { routeReducer as router } from 'react-router-redux'
2
+
import { routerReducer as router } from 'react-router-redux'
3
3
import counter from './modules/counter'
4
4
5
5
export default combineReducers({
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4