Skip to content

Commit 12d26c0

Browse files
committed
Add version caveats for scroll-behavior docs
1 parent 1139893 commit 12d26c0

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

docs/API.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ A [location descriptor](https://github.com/mjackson/history/blob/master/docs/Glo
117117
* `hash`: A hash to put in the URL, e.g. `#a-hash`.
118118
* `state`: State to persist to the `location`.
119119

120-
##### `query` **([Deprecated](https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
120+
##### `query` **([Deprecated](/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
121121
An object of key:value pairs to be stringified.
122122

123-
##### `hash` **([Deprecated](https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
123+
##### `hash` **([Deprecated](/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
124124
A hash to put in the URL, e.g. `#a-hash`.
125125

126-
_Note: React Router currently does not manage scroll position, and will not scroll to the element corresponding to the hash. Scroll position management utilities are available in the [scroll-behavior](https://github.com/taion/scroll-behavior) library._
126+
_Note: React Router currently does not manage scroll position, and will not scroll to the element corresponding to the hash._
127127

128-
##### `state` **([Deprecated](https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
128+
##### `state` **([Deprecated](/upgrade-guides/v2.0.0.md#link-to-onenter-and-isactive-use-location-descriptors) see `to`)**
129129
State to persist to the `location`.
130130

131131
##### `activeClassName`

upgrade-guides/v2.0.0.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,33 @@ import { browserHistory } from 'react-router'
7272
// v1.x
7373
import createHashHistory from 'history/lib/createHashHistory'
7474
const history = createHashHistory({ queryKey: false })
75-
<Router history={history}/>
75+
<Router history={history} />
7676

7777
// v2.0.0
7878
import { Router, useRouterHistory } from 'react-router'
7979
import { createHashHistory } from 'history'
8080
// useRouterHistory creates a composable higher-order function
8181
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
82-
<Router history={appHistory}/>
82+
<Router history={appHistory} />
8383
```
8484

8585
### Using Scroll Behavior
8686

8787
```js
88-
// v1.x
88+
// v1.x, scroll-behavior < v0.5.0
8989
import createBrowserHistory from 'history/lib/createBrowserHistory'
9090
import useScroll from 'scroll-behavior/lib/useStandardScroll'
91+
9192
const history = useScroll(createBrowserHistory)()
92-
<Router history={history}/>
93+
<Router history={history} />
9394

94-
// v2.0.0
95+
// v2.0.0, scroll-behavior < v0.5.0
9596
import { Router, useRouterHistory } from 'react-router'
9697
import createBrowserHistory from 'history/lib/createBrowserHistory';
9798
import useScroll from 'scroll-behavior/lib/useStandardScroll';
9899

99100
const appHistory = useScroll(useRouterHistory(createBrowserHistory))();
100-
<Router history={appHistory}/>
101+
<Router history={appHistory} />
101102
```
102103

103104
## Changes to `this.context`
@@ -234,7 +235,7 @@ const DeepComponent = React.createClass({
234235
router: React.PropTypes.object.isRequired
235236
},
236237
handleSubmit() {
237-
this.context.router.push(...)
238+
this.context.router.push(...)
238239
}
239240
}
240241

@@ -253,10 +254,10 @@ const DeepComponent = React.createClass({
253254
254255
```js
255256
// v1.0.x
256-
<Link to="/foo" query={{ the: 'query' }}/>
257+
<Link to="/foo" query={{ the: 'query' }} />
257258

258259
// v2.0.0
259-
<Link to={{ pathname: '/foo', query: { the: 'query' } }}/>
260+
<Link to={{ pathname: '/foo', query: { the: 'query' } }} />
260261

261262
// Still valid in 2.x
262263
<Link to="/foo"/>
@@ -304,7 +305,7 @@ const appHistory = createAppHistory({
304305
stringifyQuery: stringify
305306
})
306307

307-
<Router history={appHistory}/>
308+
<Router history={appHistory} />
308309
```
309310
## Other Changes
310311
@@ -323,7 +324,7 @@ You can now pass a `render` prop to `Router` for it to use for rendering. This a
323324
324325
```js
325326
// the default is basically this:
326-
<Router render={props => <RouterContext {...props}/>}/>
327+
<Router render={props => <RouterContext {...props} />} />
327328
```
328329
329330
`RoutingContext` was undocumented and therefore has no backwards compatibility.

upgrade-guides/v2.4.0.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ import React from 'react'
1111
import { withRouter } from 'react-router'
1212

1313
const Page = React.createClass({
14-
1514
componentDidMount() {
1615
this.props.router.setRouteLeaveHook(this.props.route, () => {
1716
if (this.state.unsaved)
1817
return 'You have unsaved information, are you sure you want to leave this page?'
1918
})
20-
}
19+
},
2120

2221
render() {
2322
return <div>Stuff</div>
2423
}
25-
2624
})
2725

2826
export default withRouter(Page)

0 commit comments

Comments
 (0)