Skip to content

Commit

Permalink
Don't use a nested component
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 16, 2015
1 parent a4f6ac8 commit b4f32c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ function getTitleFromPropsList(propsList) {
}
}

var SetDocumentTitle = createSideEffect(function handleChange(propsList) {
var DocumentTitle = createSideEffect(function handleChange(propsList) {
var title = getTitleFromPropsList(propsList);

if (typeof document !== 'undefined') {
document.title = title || '';
} else {
_serverTitle = title || null;
}
});

var DocumentTitle = React.createClass({
}, {
displayName: 'DocumentTitle',

propTypes: {
Expand All @@ -36,13 +34,9 @@ var DocumentTitle = React.createClass({

rewind: function () {
var title = _serverTitle;
SetDocumentTitle.dispose();
this.dispose();
return title;
}
},

render: function () {
return React.createElement(SetDocumentTitle, this.props);
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"react": "^0.12.0"
},
"dependencies": {
"react-side-effect": "~0.1.0"
"react-side-effect": "~0.2.0"
}
}

0 comments on commit b4f32c8

Please sign in to comment.