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

Commit fc12f70

Browse files
committed
Begin updating example in README. Re #259
1 parent 4afd74f commit fc12f70

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ View the [CHANGELOG](https://github.com/rackt/react-router-redux/blob/master/CHA
2222

2323
Read the [API docs](#api) farther down this page.
2424

25-
**Note:** We are [currently discussing some major changes](https://github.com/rackt/react-router-redux/issues/257) to the library. [React Router's API in 2.0](https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md) is significantly improved and obseletes the need for things like action creators and reading location state from the Redux. This library is still critical to enable things like time traveling and persisting state, so we're not going anywhere. But in many cases, you may not need this library and can simply use the provided React Router APIs. Go check them out and drop some technical debt. :smile:
25+
**Note:** We are [currently discussing some major changes](https://github.com/rackt/react-router-redux/issues/257) to the library. [React Router's API in 2.0](https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md) is significantly improved and makes things like action creators and reading location state from Redux obsolete. This library is still critical to enable things like time traveling and persisting state, so we're not going anywhere. But in many cases, you may not need this library and can simply use the provided React Router APIs. Go check them out and drop some technical debt. :smile:
2626

2727
### Usage
2828

@@ -44,25 +44,25 @@ import ReactDOM from 'react-dom'
4444
import { createStore, combineReducers, applyMiddleware } from 'redux'
4545
import { Provider } from 'react-redux'
4646
import { Router, Route, browserHistory } from 'react-router'
47-
import { syncHistory, routeReducer } from 'react-router-redux'
47+
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
48+
4849
import reducers from '<project-path>/reducers'
4950

5051
const reducer = combineReducers(Object.assign({}, reducers, {
51-
routing: routeReducer
52+
routing: routerReducer
5253
}))
5354

54-
// Sync dispatched route actions to the history
55-
const reduxRouterMiddleware = syncHistory(browserHistory)
56-
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore)
55+
const store = createStore(reducer)
5756

58-
const store = createStoreWithMiddleware(reducer)
57+
// Sync dispatched route actions to the history
58+
const history = syncHistoryWithStore(browserHistory, store)
5959

6060
// Required for replaying actions from devtools to work
6161
reduxRouterMiddleware.listenForReplays(store)
6262

6363
ReactDOM.render(
6464
<Provider store={store}>
65-
<Router history={browserHistory}>
65+
<Router history={history}>
6666
<Route path="/" component={App}>
6767
<Route path="foo" component={Foo}/>
6868
<Route path="bar" component={Bar}/>
@@ -73,7 +73,7 @@ ReactDOM.render(
7373
)
7474
```
7575

76-
Now you can read from `state.routing.location.pathname` to get the URL. It's far more likely that you want to change the URL more often, however. You can use the `push` action creator that we provide:
76+
Now you can read from `state.routing.locationBeforeTransitions.pathname` to get the URL. It's far more likely that you want to change the URL more often, however. You can use the `push` action creator that we provide:
7777

7878
```js
7979
import { routeActions } from 'react-router-redux'

0 commit comments

Comments
 (0)