set and render page title

note this requires changes to thundercats to work
see: thundercatsjs/thundercats-react/issues/3
This commit is contained in:
Berkeley Martinez
2015-07-29 10:16:48 -07:00
parent 549ab1bd0e
commit c82b2e3ae6
7 changed files with 46 additions and 7 deletions

View File

@@ -20,9 +20,26 @@ export default contain(
propTypes: {
children: PropTypes.node,
username: PropTypes.string,
points: PropTypes.number,
picture: PropTypes.string
picture: PropTypes.string,
title: PropTypes.string,
username: PropTypes.string
},
componentDidMount() {
const title = this.props.title;
this.setTitle(title);
},
componentWillReceiveProps(nextProps) {
if (nextProps.title !== this.props.title) {
this.setTitle(nextProps.title);
}
},
setTitle(title) {
const doc = typeof document !== 'undefined' ? document : {};
doc.title = title;
},
render() {