Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit fbe174f

Browse files
committed
Update the example against the new API.
Not that bad. In fact, it's mostly stuff removed! :)
1 parent 21b511b commit fbe174f

File tree

3 files changed

+25
-37
lines changed

3 files changed

+25
-37
lines changed

examples/basic/app.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@ import React from 'react'
66
import ReactDOM from 'react-dom'
77
import { applyMiddleware, compose, createStore, combineReducers } from 'redux'
88
import { Provider } from 'react-redux'
9-
import { Router, Route, IndexRoute } from 'react-router'
10-
import createHistory from 'history/lib/createHashHistory'
11-
import { syncHistory, routeReducer } from 'react-router-redux'
9+
import { Router, Route, IndexRoute, hashHistory } from 'react-router'
10+
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
1211

1312
import * as reducers from './reducers'
1413
import { App, Home, Foo, Bar } from './components'
1514

16-
const history = createHistory()
17-
const middleware = syncHistory(history)
1815
const reducer = combineReducers({
1916
...reducers,
20-
routing: routeReducer
17+
routing: routerReducer
2118
})
2219

2320
const DevTools = createDevTools(
@@ -27,12 +24,11 @@ const DevTools = createDevTools(
2724
</DockMonitor>
2825
)
2926

30-
const finalCreateStore = compose(
31-
applyMiddleware(middleware),
27+
const store = createStore(
28+
reducer,
3229
DevTools.instrument()
33-
)(createStore)
34-
const store = finalCreateStore(reducer)
35-
middleware.listenForReplays(store)
30+
)
31+
const history = syncHistoryWithStore(hashHistory, store)
3632

3733
ReactDOM.render(
3834
<Provider store={store}>

examples/basic/components/App.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import React from 'react'
2-
import { Link } from 'react-router'
3-
import { connect } from 'react-redux'
4-
import { routeActions } from 'react-router-redux'
2+
import { Link, hashHistory } from 'react-router'
53

6-
function App({ push, children }) {
4+
export default function App({ children }) {
75
return (
86
<div>
97
<header>
@@ -16,14 +14,9 @@ function App({ push, children }) {
1614
<Link to="/bar">Bar</Link>
1715
</header>
1816
<div>
19-
<button onClick={() => push('/foo')}>Go to /foo</button>
17+
<button onClick={() => hashHistory.push('/foo')}>Go to /foo</button>
2018
</div>
2119
<div style={{ marginTop: '1.5em' }}>{children}</div>
2220
</div>
2321
)
2422
}
25-
26-
export default connect(
27-
null,
28-
routeActions
29-
)(App)

examples/basic/package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,27 @@
44
"repository": "rackt/react-router-redux",
55
"license": "MIT",
66
"dependencies": {
7-
"history": "^1.14.0",
8-
"react": "^0.14.2",
9-
"react-dom": "^0.14.2",
10-
"react-redux": "^4.0.0",
11-
"react-router": "^1.0.0",
12-
"redux": "^3.0.4",
13-
"react-router-redux": "^2.1.0"
7+
"react": "^0.14.7",
8+
"react-dom": "^0.14.7",
9+
"react-redux": "^4.3.0",
10+
"react-router": "^2.0.0-rc5",
11+
"redux": "^3.2.1",
12+
"react-router-redux": "^3.0.0"
1413
},
1514
"devDependencies": {
16-
"babel-core": "^6.1.21",
17-
"babel-eslint": "^5.0.0-beta6",
18-
"babel-loader": "^6.2.0",
19-
"babel-preset-es2015": "^6.1.18",
20-
"babel-preset-react": "^6.1.18",
15+
"babel-core": "^6.4.5",
16+
"babel-eslint": "^5.0.0-beta9",
17+
"babel-loader": "^6.2.2",
18+
"babel-preset-es2015": "^6.3.13",
19+
"babel-preset-react": "^6.3.13",
2120
"babel-preset-stage-1": "^6.3.13",
2221
"eslint": "^1.10.3",
2322
"eslint-config-rackt": "^1.1.1",
24-
"eslint-plugin-react": "^3.15.0",
25-
"redux-devtools": "^3.0.0",
23+
"eslint-plugin-react": "^3.16.1",
24+
"redux-devtools": "^3.1.0",
2625
"redux-devtools-dock-monitor": "^1.0.1",
27-
"redux-devtools-log-monitor": "^1.0.1",
28-
"webpack": "^1.12.6"
26+
"redux-devtools-log-monitor": "^1.0.4",
27+
"webpack": "^1.12.13"
2928
},
3029
"scripts": {
3130
"start": "webpack --watch"

0 commit comments

Comments
 (0)