This repository was archived by the owner on May 23, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -2,30 +2,34 @@ import React from 'react'
2
2
3
3
export default linkFactory
4
4
5
- let linkFactory = ( router ) => {
5
+ linkFactory = ( router ) => {
6
6
return React . createClass ( {
7
7
propTypes : {
8
- routeName : React . PropTypes . string . isRequired
8
+ routeName : React . PropTypes . string . isRequired ,
9
9
routeParams : React . PropTypes . object ,
10
10
routeOptions : React . PropTypes . object ,
11
11
activeClass : React . PropTypes . string ,
12
12
onClick : React . PropTypes . func
13
13
} ,
14
14
15
- getDefaultProps ( ) ( {
16
- className : '' ,
17
- activeClass : 'active' ,
18
- routeParams : { } ,
19
- routeOptions : { } ,
20
- onClick : this . clickHandler
21
- } ) ,
15
+ getDefaultProps ( ) {
16
+ return {
17
+ className : '' ,
18
+ activeClass : 'active' ,
19
+ routeParams : { } ,
20
+ routeOptions : { } ,
21
+ onClick : this . clickHandler
22
+ } ;
23
+ } ,
22
24
23
- getInitialState ( ) ( {
25
+ getInitialState ( ) {
24
26
// Initialise state
25
27
// Not an anti-pattern
26
28
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
27
- active : router . isActive ( this . props . routeName , this . prop . routeParams )
28
- } ) ,
29
+ return {
30
+ active : router . isActive ( this . props . routeName , this . prop . routeParams )
31
+ } ;
32
+ } ,
29
33
30
34
// Is it overkill?
31
35
shouldComponentUpdate ( nextProps , nextState ) {
@@ -53,7 +57,7 @@ let linkFactory = (router) => {
53
57
54
58
componentWillUnmount ( ) {
55
59
router . removeListener ( this . routeChangeHandler )
56
- }
60
+ } ,
57
61
58
62
render ( ) {
59
63
let props = this . props
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ export default segmentMixinFactory
2
2
3
3
let segmentMixinFactory = ( router ) => {
4
4
return ( routeName , listener ) => ( {
5
- nodeListener : ( ) {
6
- listener . bind ( this ) ( )
5
+ nodeListener ( ) {
6
+ listener . call ( this )
7
7
} ,
8
8
9
9
componentDidMount ( ) {
@@ -16,4 +16,4 @@ let segmentMixinFactory = (router) => {
16
16
router . deregisterComponent ( routeName , this )
17
17
}
18
18
} )
19
- } )
19
+ }
You can’t perform that action at this time.
0 commit comments