You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: upgrade-guides/v2.0.0.md
+64-71Lines changed: 64 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,11 +60,9 @@ import { browserHistory } from 'react-router'
60
60
<Router history={browserHistory} />
61
61
```
62
62
63
-
## Changes to context and Mixins
63
+
## Changes to `this.context`
64
64
65
-
Only an object named `router` is added to context. Accessing `this.context.history`, `this.context.location`, and `this.context.route` are all deprecated.
66
-
67
-
Additionally, since [`context` is now documented](https://facebook.github.io/react/docs/context.html), all mixins are deprecated as they simply served to conceal usage of context.
65
+
Only an object named `router` is added to context. Accessing `this.context.history`, `this.context.location`, and `this.context.route` are all deprecated. This new object contains the methods available from `history` (such as `push`, `replace`) along with `setRouteLeaveHook`.
Since [`context` is now documented](https://facebook.github.io/react/docs/context.html), all mixins are deprecated as they simply served to conceal usage of context.
You don't need to manually tear down the route leave hook in most cases. We automatically remove all attached route leave hooks after leaving the associated route.
You don't need to manually tear down the route leave hook in most cases. We automatically remove all attached route leave hooks after leaving the associated route.
192
-
193
209
## `<Link to>` and `isActive` take location descriptors
194
210
195
211
`<Link to>` can now take a location descriptor in addition to strings. The `query` and `state` props are deprecated.
You can now pass a `render` prop to `Router` for it to use for rendering. This allows you to create "middleware components" that participate in routing. Its critical for integrations with libraries like Relay, Redux, Resolver, Transmit, Async Props, etc.
272
267
@@ -276,5 +271,3 @@ You can now pass a `render` prop to `Router` for it to use for rendering. This a
276
271
```
277
272
278
273
`RoutingContext` was undocumented and therefore has no backwards compatibility.
0 commit comments