Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
React Component Template
var _debug = true;
var XXXXXX = React.createClass({
displayName: 'XXXXXX',
// Mixins
mixins: [],
// Props
propTypes: {
},
getDefaultProps: function() {
_debug ? console.log('XXXXXX => getDefaultProps | props:', this.props) : null;
return {
};
},
// State
getInitialState: function() {
_debug ? console.log('XXXXXX => getInitialState | state:', this.state) : null;
return {
};
},
// Mount
componentWillMount: function() {
_debug ? console.log('XXXXXX => componentWillMount | state:', this.state, ', props:', this.props) : null;
},
componentDidMount: function() {
_debug ? console.log('XXXXXX => componentDidMount | state:', this.state, ', props:', this.props) : null;
// React.findDOMNode(this)
},
componentWillUnmount: function() {
_debug ? console.log('XXXXXX => componentWillUnmount | state:', this.state, ', props:', this.props) : null;
},
// Updates
componentWillReceiveProps: function(nextProps) {
_debug ? console.log('SignIn => componentWillReceiveProps | props:', this.props, ', nextProps:', nextProps) : null;
},
//shouldComponentUpdate: function() {},
componentWillUpdate: function() {
_debug ? console.log('XXXXXX => componentWillUpdate | state:', this.state, ', props:', this.props) : null;
},
componentDidUpdate: function() {
_debug ? console.log('XXXXXX => componentDidUpdate | state:', this.state, ', props:', this.props) : null;
// DOM stuff here
},
// render
render: function() {
_debug ? console.log('XXXXXX => render | state:', this.state, ', props:', this.props) : null;
},
});
module.exports = XXXXXX;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment