Skip to content

Commit f3e406b

Browse files
committed
couple upgrade guide adjustments
1 parent 4a5ff49 commit f3e406b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

UPGRADE_GUIDE.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ var ReactRouter = require('react-router');
3030
var Router = ReactRouter.Router;
3131
var Route = ReactRouter.Route;
3232

33-
// or using object destructuring
34-
var { Router, Route } = require('react-router');
33+
// or using ES Modules
34+
import { Router, Route } from 'react-router';
3535
```
3636

3737
### Rendering
@@ -73,7 +73,7 @@ let history = createBrowserHistory()
7373
render(<Router history={history}>{routes}</Router>, el)
7474
```
7575

76-
If you do not specify a history type (as in the example above) then you will notice some unusual behaviour after updating to 1.0.0. With the default hash based routing a querystring entry not defined by yourself will start appearing in your URLs called "_k". An example of how it looks is this: `?_k=umhx1s`.
76+
If you do not specify a history type (as in the example above) then you will notice some unusual behaviour after updating to 1.0.0. With the default hash based routing a querystring entry not defined by yourself will start appearing in your URLs called `_k`. An example of how it looks is this: `?_k=umhx1s`
7777

7878
This is intended and part of [createHashHistory](https://github.com/rackt/react-router/blob/master/docs/guides/basics/Histories.md#createhashhistory) (which is the default history approach used if one is not specified). You can read more about the feature [here](https://github.com/rackt/react-router/blob/master/docs/guides/basics/Histories.md#what-is-that-_kckuvup-junk-in-the-url) and how to opt out [here](https://rackt.github.io/history/stable/HashHistoryCaveats.html).
7979

@@ -108,9 +108,6 @@ since it's simple with a `*` path.
108108

109109
### Redirect route
110110

111-
- no more params
112-
- must have absolute `from` (for now)
113-
114111
```js
115112
// v0.13.x
116113
<Redirect from="some/where/:id" to="somewhere/else/:id" params={{id: 2}}/>
@@ -138,12 +135,13 @@ since it's simple with a `*` path.
138135
#### "active" class
139136

140137
In 0.13.x links added the "active" class by default which you could
141-
override with `activeClassName`, or provide `activeStyle`s. Most links
142-
don't need this and the check is (currently) expensive.
138+
override with `activeClassName`, or provide `activeStyle`s. It's usually
139+
just a handful of navigation links that need this behavior.
143140

144-
Links no longer add the "active" class by default, you opt-in by
145-
providing one; if no `activeClassName` or `activeStyle`s are provided,
146-
the link will not check if it's active.
141+
Links no longer add the "active" class by default (its expensive and
142+
usually not necessary), you opt-in by providing one; if no
143+
`activeClassName` or `activeStyle`s are provided, the link will not
144+
check if it's active.
147145

148146
```js
149147
// v0.13.x
@@ -180,6 +178,9 @@ active when on exactly that path.
180178
<IndexLink to="/">Home</IndexLink>
181179
```
182180

181+
This gives you more granular control of what causes a link to be active
182+
or not when there is an index route involved.
183+
183184
#### onClick handler
184185

185186
For consistency with React v0.14, returning `false` from a `Link`'s `onClick`
@@ -295,8 +296,9 @@ and where you get it now if you're a route component (`this.props`)
295296
| `getRoutes()` | `routes` |
296297
| `isActive(to, params, query)` | `history.isActive(pathname, query, onlyActiveOnIndex)` |
297298

298-
Here is another table of properties you used to get via the `State` and
299-
where you can get it now if you are **not** a route component (`this.context`).
299+
Here is another table of properties you used to get via the `State` and
300+
where you can get it now if you are **not** a route component
301+
(`this.context`).
300302

301303
| v0.13 (this) | v1.0 (this.context) |
302304
|-------------------|------------------------------------|
@@ -306,7 +308,7 @@ where you can get it now if you are **not** a route component (`this.context`).
306308
| `getQueryParams()`| `location.query` |
307309
| `isActive(to, params, query)` | `history.isActive(pathname, query, indexOnly)` |
308310

309-
Note not all `State` functionality can be accessed via context in v1.0.
311+
Note not all `State` functionality can be accessed via context in v1.0.
310312
For example, `params` is not available via context.
311313

312314
### Scrolling
@@ -331,10 +333,8 @@ Routes now define this behavior:
331333
// v0.13.x
332334
var Home = React.createClass({
333335
statics: {
334-
willTransitionTo (transition, params, query, callback) {
335-
}
336-
willTransitionFrom (component, transition, params, query, callback) {
337-
}
336+
willTransitionTo (transition, params, query, callback) { }
337+
willTransitionFrom (component, transition, params, query, callback) { }
338338
}
339339
})
340340

0 commit comments

Comments
 (0)