File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
2
var Route = require ( './Route' ) ;
3
3
4
- function Redirect ( props ) {
5
- return Route ( {
6
- name : props . name ,
7
- path : props . from ,
8
- handler : createRedirectClass ( props . to )
9
- } ) ;
10
- }
11
-
12
- function createRedirectClass ( to ) {
4
+ function createRedirectHandler ( to ) {
13
5
return React . createClass ( {
14
6
statics : {
15
7
willTransitionTo : function ( transition , params , query ) {
@@ -23,4 +15,16 @@ function createRedirectClass(to) {
23
15
} ) ;
24
16
}
25
17
18
+ /**
19
+ * A <Redirect> component is a special kind of <Route> that always
20
+ * redirects when it matches.
21
+ */
22
+ function Redirect ( props ) {
23
+ return Route ( {
24
+ name : props . name ,
25
+ path : props . from || props . path ,
26
+ handler : createRedirectHandler ( props . to )
27
+ } ) ;
28
+ }
29
+
26
30
module . exports = Redirect ;
You can’t perform that action at this time.
0 commit comments