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'
22
33export default linkFactory
44
5- let linkFactory = ( router ) => {
5+ linkFactory = ( router ) => {
66 return React . createClass ( {
77 propTypes : {
8- routeName : React . PropTypes . string . isRequired
8+ routeName : React . PropTypes . string . isRequired ,
99 routeParams : React . PropTypes . object ,
1010 routeOptions : React . PropTypes . object ,
1111 activeClass : React . PropTypes . string ,
1212 onClick : React . PropTypes . func
1313 } ,
1414
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+ } ,
2224
23- getInitialState ( ) ( {
25+ getInitialState ( ) {
2426 // Initialise state
2527 // Not an anti-pattern
2628 // 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+ } ,
2933
3034 // Is it overkill?
3135 shouldComponentUpdate ( nextProps , nextState ) {
@@ -53,7 +57,7 @@ let linkFactory = (router) => {
5357
5458 componentWillUnmount ( ) {
5559 router . removeListener ( this . routeChangeHandler )
56- }
60+ } ,
5761
5862 render ( ) {
5963 let props = this . props
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ export default segmentMixinFactory
22
33let segmentMixinFactory = ( router ) => {
44 return ( routeName , listener ) => ( {
5- nodeListener : ( ) {
6- listener . bind ( this ) ( )
5+ nodeListener ( ) {
6+ listener . call ( this )
77 } ,
88
99 componentDidMount ( ) {
@@ -16,4 +16,4 @@ let segmentMixinFactory = (router) => {
1616 router . deregisterComponent ( routeName , this )
1717 }
1818 } )
19- } )
19+ }
You can’t perform that action at this time.
0 commit comments