@@ -5,7 +5,7 @@ To see discussion around these API changes, please refer to the
5
5
[ changelog] ( /CHANGELOG.md ) and visit the commits and issues they
6
6
reference.
7
7
8
- 0.7.x -> 0.8 .x
8
+ 0.7.x -> 0.9 .x
9
9
--------------
10
10
11
11
### ` ActiveState ` mixin ` isActive `
@@ -24,7 +24,7 @@ var SomethingActive = React.createClass({
24
24
}
25
25
});
26
26
27
- // 0.8 .x
27
+ // 0.9 .x
28
28
var SomethingActive = React .createClass ({
29
29
mixins: [ActiveState],
30
30
@@ -36,17 +36,26 @@ var SomethingActive = React.createClass({
36
36
});
37
37
```
38
38
39
- ### ` <Routes onActiveStateChange/> ` -> ` PathState `
39
+ ### ` <Routes onActiveStateChange/> ` -> ` <Routes onChange /> `
40
40
41
41
``` js
42
42
// 0.7.x
43
43
< Routes onActiveStateChange= {fn} / >
44
44
45
- // 0.8.x
46
- var App = React .createClass ({
47
- mixins: [PathState],
48
- updatePath: fn
49
- });
45
+ function fn (nextState ) {}
46
+
47
+ // 0.9.x
48
+ < Routes onActiveStateChange= {fn} / >
49
+
50
+ function fn () {
51
+ // no arguments
52
+ // `this` is the routes instance
53
+ // here are some useful methods to get at the data you probably need
54
+ this .getCurrentPath ();
55
+ this .getActiveRoutes ();
56
+ this .getActiveParams ();
57
+ this .getActiveQuery ();
58
+ }
50
59
```
51
60
52
61
You may need access to the current routes, use the ` RouteLookup ` mixin
@@ -55,25 +64,7 @@ for that along with `PathState`.
55
64
### ` . ` in params support
56
65
57
66
` . ` used to be a delimiter like ` / ` , but now its a valid character in
58
- your params. If you were using this feature you'll need to do the split
59
- yourself.
60
-
61
- ```
62
- // 0.7.x
63
- var route = <Route path=":foo.:bar" />;
64
-
65
- // 0.8.x
66
- var route = <Route path=":foobar" handler={Handler}/>
67
-
68
- Handler = React.createClass({
69
- render: function() {
70
- var split = this.props.params.foobar.split('.');
71
- var foo = split[0];
72
- var bar = split[1];
73
- // ...
74
- }
75
- });
76
- ```
67
+ your params.
77
68
78
69
### ` transition.retry() `
79
70
@@ -89,9 +80,9 @@ React.createClass({
89
80
}
90
81
});
91
82
92
- // 0.8 .x
83
+ // 0.9 .x
93
84
React .createClass ({
94
- mixins: [Transitions ],
85
+ mixins: [Navigation ],
95
86
login : function () {
96
87
// ...
97
88
this .transitionTo (transition .path );
@@ -114,7 +105,7 @@ React.createClass({
114
105
}
115
106
});
116
107
117
- // 0.8 .x
108
+ // 0.9 .x
118
109
React .createClass ({
119
110
statics: {
120
111
willTransitionTo : function (transition ) {
@@ -129,17 +120,17 @@ React.createClass({
129
120
` preserveScrollPosition ` was totally broken and should have been named
130
121
` perverseScrollPosition ` .
131
122
123
+
132
124
There are now three scroll behaviors you can use:
133
125
134
- - ` 'imitateBrowser ' `
126
+ - ` 'browser ' `
135
127
- ` 'scrollToTop' `
136
128
- ` 'none' `
137
129
138
- ` imitateBrowser ` is the default, and imitates what browsers do in a
139
- typical page reload scenario (preserves scroll positions when using the
140
- back button, scrolls up when you come to a new page, etc.)
141
-
142
- Also, you can't specify scroll behavior per ` <Route/> ` anymore.
130
+ ` browser ` is the default, and imitates what browsers do in a typical
131
+ page reload scenario (preserves scroll positions when using the back
132
+ button, scrolls up when you come to a new page, etc.) Also, you can no
133
+ longer specify scroll behavior per ` <Route/> ` anymore, only ` <Routes/> `
143
134
144
135
```
145
136
<Routes scrollBehavior="scrollToTop"/>
@@ -149,7 +140,7 @@ Also, you can't specify scroll behavior per `<Route/>` anymore.
149
140
150
141
This was not a public module, but we know some people were using it.
151
142
It's gone now. We have made getting at the current routes incredibly
152
- convenient now with the ` RouteLookup ` mixin.
143
+ convenient now with additions to the ` ActiveState ` mixin.
153
144
154
145
### ` Router.transitionTo, replaceWith, goBack `
155
146
@@ -167,9 +158,11 @@ React.createClass({
167
158
}
168
159
});
169
160
170
- // 0.8.x
161
+ // 0.9.x
162
+ var Navigation = Router .Navigation ;
163
+
171
164
React .createClass ({
172
- mixins: [Router . Transitions ],
165
+ mixins: [Navigation ],
173
166
whenever : function () {
174
167
this .transitionTo (' something' );
175
168
this .replaceWith (' something' );
@@ -178,7 +171,15 @@ React.createClass({
178
171
});
179
172
```
180
173
174
+ 0.7.x -> 0.8.x
175
+ --------------
176
+
177
+ Please don't upgrade to ` 0.8.0 ` , just skip to ` 0.9.x ` .
181
178
179
+ ` 0.8.0 ` had some transient mixins we didn't intend to document, but had
180
+ some miscommunication :( If you were one of three people who used some
181
+ of these mixins and need help upgrading from ` 0.8.0 -> 0.9.x ` find us on
182
+ freenode in ` #rackt ` or open a ticket. Thanks!
182
183
183
184
0.6.x -> 0.7.x
184
185
--------------
0 commit comments