Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions modules/Title.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'

let titles = []

Expand All @@ -16,27 +17,25 @@ export function flushTitle() {
return title
}

const { oneOfType, string, func } = React.PropTypes

const Title = React.createClass({

propTypes: {
render: oneOfType([ string, func ]).isRequired
},

getInitialState() {
return {
class Title extends React.Component {
constructor(props) {
super(props)
this.state = {
index: titles.push('') - 1
}
},
}

componentWillUnmount() {
titles.pop()
},
}

componentDidMount: updateTitle,
componentDidMount() {
updateTitle()
}

componentDidUpdate: updateTitle,
componentDidUpdate() {
updateTitle()
}

render() {
const { render } = this.props
Expand All @@ -45,8 +44,12 @@ const Title = React.createClass({
: render
return this.props.children || null
}
}

const { oneOfType, string, func } = React.PropTypes

})
Title.propTypes = {
render: oneOfType([ string, func ]).isRequired
}

export default Title

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"karma-webpack": "^1.7.0",
"mocha": "^2.0.1",
"pretty-bytes": "^2.0.1",
"prop-types": "^15.5.6",
"react": "^0.14.0",
"react-addons-test-utils": "0.14.0",
"react-dom": "^0.14.0",
Expand Down