Skip to content
This repository was archived by the owner on May 23, 2018. It is now read-only.

Commit

Permalink
fix: syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
troch committed Jul 7, 2015
1 parent 55db083 commit 3140dcd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
30 changes: 17 additions & 13 deletions modules/link-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@ import React from 'react'

export default linkFactory

let linkFactory = (router) => {
linkFactory = (router) => {
return React.createClass({
propTypes: {
routeName: React.PropTypes.string.isRequired
routeName: React.PropTypes.string.isRequired,
routeParams: React.PropTypes.object,
routeOptions: React.PropTypes.object,
activeClass: React.PropTypes.string,
onClick: React.PropTypes.func
},

getDefaultProps() ({
className: '',
activeClass: 'active',
routeParams: {},
routeOptions: {},
onClick: this.clickHandler
}),
getDefaultProps() {
return {
className: '',
activeClass: 'active',
routeParams: {},
routeOptions: {},
onClick: this.clickHandler
};
},

getInitialState() ({
getInitialState() {
// Initialise state
// Not an anti-pattern
// https://facebook.github.io/react/tips/props-in-getInitialState-as-anti-pattern.html
active: router.isActive(this.props.routeName, this.prop.routeParams)
}),
return {
active: router.isActive(this.props.routeName, this.prop.routeParams)
};
},

// Is it overkill?
shouldComponentUpdate(nextProps, nextState) {
Expand Down Expand Up @@ -53,7 +57,7 @@ let linkFactory = (router) => {

componentWillUnmount() {
router.removeListener(this.routeChangeHandler)
}
},

render() {
let props = this.props
Expand Down
6 changes: 3 additions & 3 deletions modules/segment-mixin-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export default segmentMixinFactory

let segmentMixinFactory = (router) => {
return (routeName, listener) => ({
nodeListener: () {
listener.bind(this)()
nodeListener() {
listener.call(this)
},

componentDidMount() {
Expand All @@ -16,4 +16,4 @@ let segmentMixinFactory = (router) => {
router.deregisterComponent(routeName, this)
}
})
})
}

0 comments on commit 3140dcd

Please sign in to comment.