git ssb

1+

dinoworm ๐Ÿ› / catstack



Commit 8839d20da5b689e93b4be966ff279ff8f00cbf06

react-router-redux instead of redux-simple-router

Iain Kirkpatrick committed on 4/11/2016, 4:36:39 AM
Parent: b80a014a9abc4efe846d5315bc0e897de98a2709

Files changed

app/reducer.jschanged
app/render-browser.jschanged
app/store.jschanged
package.jsonchanged
app/reducer.jsView
@@ -1,7 +1,7 @@
11 const bulk = require('bulk-require')
22 import { combineReducers } from 'redux'
3-import { routeReducer } from 'redux-simple-router'
3+import { routerReducer } from 'react-router-redux'
44 import { map, mapValues, assign, camelCase, mapKeys } from 'lodash'
55
66 export default combine(assign(
77 mapValues(
@@ -17,9 +17,9 @@
1717 )
1818 )
1919 ),
2020 {
21- routing: routeReducer
21+ routing: routerReducer
2222 }
2323 ))
2424
2525 function combine (reducers) {
app/render-browser.jsView
@@ -1,9 +1,9 @@
11 import React from 'react'
22 import { render } from 'react-dom'
33 import { Provider } from 'react-redux'
44 import { browserHistory as history, Router } from 'react-router'
5-import { syncReduxAndRouter } from 'redux-simple-router'
5+import { syncHistoryWithStore } from 'react-router-redux'
66
77 import createRoutes from 'app/routes'
88 import createStore from 'app/store'
99 import fetchElement from 'app/util/fetch-element'
@@ -12,11 +12,12 @@
1212 var DevTools = require('app/util/dev-tools').default
1313 }
1414
1515 const store = createStore(window.__data, history)
16+const enhancedHistory = syncHistoryWithStore(history, store)
1617
1718 const main = (
18- <Router createElement={fetchElement(store)} history={history}>
19+ <Router createElement={fetchElement(store)} history={enhancedHistory}>
1920 { createRoutes(store) }
2021 </Router>
2122 )
2223
app/store.jsView
@@ -1,7 +1,7 @@
11 import { createStore, compose, applyMiddleware } from 'redux'
22 import thunk from 'redux-thunk'
3-import { syncHistory } from 'redux-simple-router'
3+import { routerMiddleware } from 'react-router-redux'
44
55 import reducer from 'app/reducer'
66
77 if (process.env.NODE_ENV === 'development') {
@@ -31,12 +31,10 @@
3131 }
3232 }
3333
3434 export default function finalCreateStore(initialState, history) {
35- const historyMiddleware = syncHistory(history)
36-
3735 const finalMiddleware = middleware.concat([
38- historyMiddleware
36+ routerMiddleware(history)
3937 ])
4038
4139 const createEnhancedStore = compose(
4240 applyMiddleware(...finalMiddleware),
@@ -44,12 +42,8 @@
4442 )(createStore)
4543
4644 const store = createEnhancedStore(reducer, initialState)
4745
48- if (process.env.NODE_ENV === 'development') {
49- historyMiddleware.listenForReplays(store)
50- }
51-
5246 if (module.hot) {
5347 module.hot.accept('app/reducer', () => {
5448 store.replaceReducer(require('app/reducer'))
5549 })
package.jsonView
@@ -133,10 +133,10 @@
133133 "react": "^15.0.1",
134134 "react-dom": "^15.0.1",
135135 "react-redux": "^4.0.1",
136136 "react-router": "^2.0.0",
137+ "react-router-redux": "^4.0.1",
137138 "redux": "^3.0.5",
138- "redux-simple-router": "2.0.4",
139139 "redux-thunk": "^2.0.1",
140140 "reselect": "^2.0.2",
141141 "send-data": "^8.0.0",
142142 "simple-rc": "^1.0.3",

Built with git-ssb-web