more react changes, incomplete

This commit is contained in:
Colin McLeod
2015-11-29 18:44:59 -08:00
parent ed637addb8
commit 79224f4f9a
201 changed files with 3594 additions and 2329 deletions

36
src/app/pages/Page.jsx Normal file
View File

@@ -0,0 +1,36 @@
import React from 'react';
import shallowEqual from '../utils/shallowEqual';
export default class Page extends React.Component {
static contextTypes = {
route: React.PropTypes.object.isRequired,
language: React.PropTypes.object.isRequired
};
constructor(props) {
super(props);
// Autobind private functions
Object.getOwnPropertyNames(this.constructor.prototype).forEach(prop => {
if(prop.charAt(0) == '_' && typeof this[prop] === "function") {
this[prop] = this[prop].bind(this);
}
});
}
shouldComponentUpdate(nextProps, nextState, nextContext) {
return !shallowEqual(this.props, nextProps)
|| !shallowEqual(this.state, nextState)
|| !shallowEqual(this.context, nextContext)
}
componentWillMount() {
document.title = this.state.title || 'Coriolis';
}
componentWillUpdate(newProps, newState) {
document.title = newState.title || 'Coriolis';
}
}