@@ -5,6 +5,181 @@ 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
9
+ --------------
10
+
11
+ ### ` ActiveState ` mixin ` isActive `
12
+
13
+ ` isActive ` is now an instance method.
14
+
15
+ ``` js
16
+ // 0.7.x
17
+ var SomethingActive = React .createClass ({
18
+ mixins: [ActiveState],
19
+
20
+ updateActiveState : function () {
21
+ this .setState ({
22
+ isActive: SomethingActive .isActive (... )
23
+ })
24
+ }
25
+ });
26
+
27
+ // 0.8.x
28
+ var SomethingActive = React .createClass ({
29
+ mixins: [ActiveState],
30
+
31
+ updateActiveState : function () {
32
+ this .setState ({
33
+ isActive: this .isActive (... )
34
+ })
35
+ }
36
+ });
37
+ ```
38
+
39
+ ### ` <Routes onActiveStateChange/> ` -> ` PathState `
40
+
41
+ ``` js
42
+ // 0.7.x
43
+ < Routes onActiveStateChange= {fn} / >
44
+
45
+ // 0.8.x
46
+ var App = React .createClass ({
47
+ mixins: [PathState],
48
+ updatePath: fn
49
+ });
50
+ ```
51
+
52
+ You may need access to the current routes, use the ` RouteLookup ` mixin
53
+ for that along with ` PathState ` .
54
+
55
+ ### ` . ` in params support
56
+
57
+ ` . ` 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
+ ```
77
+
78
+ ### ` transition.retry() `
79
+
80
+ ` transition.retry() ` used to use ` transitionTo ` , creating a new history
81
+ entry, it now uses ` replaceWith ` .
82
+
83
+ ``` js
84
+ // 0.7.x
85
+ React .createClass ({
86
+ login : function () {
87
+ // ...
88
+ transition .retry ();
89
+ }
90
+ });
91
+
92
+ // 0.8.x
93
+ React .createClass ({
94
+ mixins: [Transitions],
95
+ login : function () {
96
+ // ...
97
+ this .transitionTo (transition .path );
98
+ }
99
+ });
100
+ ```
101
+
102
+ ### Returning promises from transition hooks
103
+
104
+ Transition hooks are now sync, unless you opt-in to async with
105
+ ` transition.wait(promise) ` .
106
+
107
+ ``` js
108
+ // 0.7.x
109
+ React .createClass ({
110
+ statics: {
111
+ willTransitionTo : function (transition ) {
112
+ return somePromise ();
113
+ }
114
+ }
115
+ });
116
+
117
+ // 0.8.x
118
+ React .createClass ({
119
+ statics: {
120
+ willTransitionTo : function (transition ) {
121
+ transition .wait (somePromise ());
122
+ }
123
+ }
124
+ });
125
+ ```
126
+
127
+ ### ` preserveScrollPosition ` -> ` scrollBehavior `
128
+
129
+ ` preserveScrollPosition ` was totally broken and should have been named
130
+ ` perverseScrollPosition ` .
131
+
132
+ There are now three scroll behaviors you can use:
133
+
134
+ - ` 'imitateBrowser' `
135
+ - ` 'scrollToTop' `
136
+ - ` 'none' `
137
+
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.
143
+
144
+ ```
145
+ <Routes scrollBehavior="scrollToTop"/>
146
+ ```
147
+
148
+ ### RouteStore
149
+
150
+ This was not a public module, but we know some people were using it.
151
+ It's gone now. We have made getting at the current routes incredibly
152
+ convenient now with the ` RouteLookup ` mixin.
153
+
154
+ ### ` Router.transitionTo, replaceWith, goBack `
155
+
156
+ These methods have been moved to mixins.
157
+
158
+ ``` js
159
+ var Router = require (' react-router' );
160
+
161
+ // 0.7.x
162
+ React .createClass ({
163
+ whenever : function () {
164
+ Router .transitionTo (' something' );
165
+ Router .replaceWith (' something' );
166
+ Router .goBack ();
167
+ }
168
+ });
169
+
170
+ // 0.8.x
171
+ React .createClass ({
172
+ mixins: [Router .Transitions ],
173
+ whenever : function () {
174
+ this .transitionTo (' something' );
175
+ this .replaceWith (' something' );
176
+ this .goBack ();
177
+ }
178
+ });
179
+ ```
180
+
181
+
182
+
8
183
0.6.x -> 0.7.x
9
184
--------------
10
185
0 commit comments