Skip to content

Commit aabd195

Browse files
committed
Merge pull request remix-run#2110 from zenlambda/patch-1
Clarify available State information in context
2 parents 3ef848e + 09eec85 commit aabd195

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

UPGRADE_GUIDE.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ var Assignment = React.createClass({
245245
// if you're not a route component, you need to pass location down the
246246
// tree or get the location from context. We will probably provide a
247247
// higher order component that will do this for you but haven't yet.
248+
// see further down for more information on what can be passed down
249+
// via context
248250
var Assignment = React.createClass({
249251
contextTypes: {
250252
location: React.PropTypes.object
@@ -261,13 +263,26 @@ and where you get it now if you're a route component (`this.props`)
261263

262264
| v0.13 (this) | v1.0 (this.props) |
263265
|-----------------|------------------------------------|
264-
| `getPath()` | `location.pathname+location.query` |
266+
| `getPath()` | `location.pathname+location.search` |
265267
| `getPathname()` | `location.pathname` |
266268
| `getParams()` | `params` |
267-
| `getQuery()` | `location.query` |
269+
| `getQuery()` | `location.search` |
268270
| `getRoutes()` | `routes` |
269271
| `isActive(to, params, query)` | `history.isActive(pathname, query, onlyActiveOnIndex)` |
270272

273+
Here is another table of properties you used to get via the `State` and
274+
where you can get it now if you are **not** a route component (`this.context`).
275+
276+
| v0.13 (this) | v1.0 (this.context) |
277+
|-----------------|------------------------------------|
278+
| `getPath()` | `location.pathname+location.search`|
279+
| `getPathname()` | `location.pathname` |
280+
| `getQuery()` | `location.search` |
281+
| `isActive(to, params, query)` | `history.isActive(pathname, query, onlyActiveOnIndex)` |
282+
283+
Note not all `State` functionality can be accessed via context in v1.0.
284+
For example, `params` is not available via context.
285+
271286
### Scrolling
272287

273288
In 0.13.x we had a couple of implementations to restore scroll position,

0 commit comments

Comments
 (0)